Click here to Skip to main content
15,905,782 members
Home / Discussions / C#
   

C#

 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
abiemann9-Apr-09 9:12
abiemann9-Apr-09 9:12 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required PinPopular
abiemann10-Apr-09 13:58
abiemann10-Apr-09 13:58 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
ishant78907-Jul-10 20:35
ishant78907-Jul-10 20:35 
GeneralRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
eeidfn4-Oct-10 8:56
eeidfn4-Oct-10 8:56 
AnswerRe: WebRequest.GetResponse() = error (407) Proxy Authentication Required Pin
ebjean22-Jul-10 2:34
ebjean22-Jul-10 2:34 
QuestionOPC communication in c# Pin
AlessandroOPC6-Apr-09 11:29
AlessandroOPC6-Apr-09 11:29 
QuestionSystem.ArgumentException: The value of DatagridviewComboboxCell is invalid Pin
Priya Prk6-Apr-09 9:41
Priya Prk6-Apr-09 9:41 
QuestionNeed help with binding source Pin
faizych6-Apr-09 9:09
faizych6-Apr-09 9:09 
i am trying to show the records in labels like so:

User Name              User
Alias                  Alias
Income                 Income
Gender                 Gender
Age                    Age


and then i want the buttons to control so i can hit next to show the next record


so for that i have this code

public void GetUserMatch(XmlNode usersNode, string CritBody, string CritAgeFrom, string CritAgeTo, string CritHeightFrom, string CritHeightTo)
      {
         XmlNodeList userNodes = usersNode.SelectNodes("Clients");
         Users[] users = new Users[userNodes.Count];
         MatchUsers[] matchUser = new MatchUsers[users.Length];
         for (int i = 0x0; i < users.Length; i++)
         {
            XmlNode userNode = userNodes[i];
            string userName = userNode.SelectSingleNode("Username").InnerText;
            string alias = userNode.SelectSingleNode("Alias").InnerText;
            string bodyType = userNode.SelectSingleNode("BodyType").InnerText;
            string strheight = userNode.SelectSingleNode("Heightft").InnerText;
            string displayheight = userNode.SelectSingleNode("DisplayHeight").InnerText;
            string strage = userNode.SelectSingleNode("Age").InnerText;
            string gender = userNode.SelectSingleNode("Gender").InnerText;
            string income = userNode.SelectSingleNode("Income").InnerText;

            int intHeight = Convert.ToInt32(strheight);
            int intAge = Convert.ToInt32(strage);

            users[i] = new Users(userName, alias, bodyType, intHeight, displayheight, intAge, gender, income);
         }
            
         
                     
            MatchUsers[] matchUsers = new MatchUsers[0];
            int ii = 0;
               foreach (Users mUser in users)
               {
                  

                  string Bodytype = mUser.BodyType;
                  if (string.Compare(Bodytype, CritBody) == 0)
                  {
                     int intAge = Convert.ToInt32(mUser.Age);
                     if (intAge >= Convert.ToInt32(CritAgeFrom) & intAge <= Convert.ToInt32(CritAgeTo))
                     {
                        int intHeight = Convert.ToInt32(mUser.Height);
                        if (intHeight >= Convert.ToInt32(CritHeightFrom) & intHeight <= Convert.ToInt32(CritHeightTo))
                        {
                           string userName = mUser.UserName;
                           string alias = mUser.Alias;
                           string bodyType = mUser.BodyType;
                           string height = mUser.DisplayHeight;
                           string age = mUser.Age.ToString();
                           string gender = mUser.Gender;
                           string income = mUser.Income;

                           matchUser[ii] = new MatchUsers(userName, alias, bodyType, height, age, gender, income);
                           ii++;
                        }
                     }
                  }
                  
               }
              
         DataSet ds = new DataSet();
         DataTable dt = new DataTable("UserMatch");
         ds.Tables.Add(dt);

         DataColumn dc1 = new DataColumn("User Name");
         DataColumn dc2 = new DataColumn("Alias");
         DataColumn dc3 = new DataColumn("Body Type");
         DataColumn dc4 = new DataColumn("Height");
         DataColumn dc5 = new DataColumn("Age");
         DataColumn dc6 = new DataColumn("Gender");
         DataColumn dc7 = new DataColumn("Income");

         dt.Columns.Add(dc1);
         dt.Columns.Add(dc2);
         dt.Columns.Add(dc3);
         dt.Columns.Add(dc4);
         dt.Columns.Add(dc5);
         dt.Columns.Add(dc6);
         dt.Columns.Add(dc7);

         int iii = 0;
         foreach (MatchUsers mUsers in matchUser)
			{
            DataRow dr = dt.NewRow();
            if (mUsers != null)
            {
               dr["User Name"] = mUsers.UserName;
               dr["Alias"] = mUsers.Alias;
               dr["Body Type"] = mUsers.BodyType;
               dr["Height"] = mUsers.Height;
               dr["Age"] = mUsers.Age;
               dr["Gender"] = mUsers.Gender;
               dr["Income"] = mUsers.Income;

               dt.Rows.Add(dr);

               iii++;
            }
            
			}
         this.UserBindingSource.DataSource = ds;
         //Check count of bindingsource.. last checked 1
         int asdf = this.UserBindingSource.Count;

         // Bind the CompanyName field to the Label control.
         this.lblMatchUserName.DataBindings.Add(
             new Binding("Text",
             this.UserBindingSource,
             "UserMatch.User Name",
             true));
         this.lblMatchUserAlias.DataBindings.Add(
             new Binding("Text",
             this.UserBindingSource,
             "UserMatch.Alias",
             true));
         this.lblMatchUserBody.DataBindings.Add(
             new Binding("Text",
             this.UserBindingSource,
             "UserMatch.Body Type",
             true));
         this.lblMatchUserHeight.DataBindings.Add(
             new Binding("Text",
             this.UserBindingSource,
             "UserMatch.Height",
             true));
         this.lblMatchUserAge.DataBindings.Add(
             new Binding("Text",
             this.UserBindingSource,
             "UserMatch.Age",
             true));
         this.lblMatchUserGender.DataBindings.Add(
             new Binding("Text",
             this.UserBindingSource,
             "UserMatch.Gender",
             true));
         this.lblMatchUserIncome.DataBindings.Add(
             new Binding("Text",
             this.UserBindingSource,
             "UserMatch.Income",
             true));
         
      }



Now the problem im having is that when i check the count of binding source it is equal to one.. and the code i have to go to the next record is like so:

private void button1_Click(object sender, EventArgs e)
      {
         if (this.UserBindingSource.Position + 1 < this.UserBindingSource.Count)
         {
            this.UserBindingSource.MoveNext();
            this.fnDisplayPosition();
         } 

      }

      

      private void button2_Click(object sender, EventArgs e)
      {
         this.UserBindingSource.MovePrevious();
         this.fnDisplayPosition();

      }
      private void fnDisplayPosition()
      {
         this.lblPostion.Text = this.UserBindingSource.Position +
              1 + " of " + this.UserBindingSource.Count;
      }



so the part
if (this.UserBindingSource.Position + 1 &lt; this.UserBindingSource.Count)
is never true because binding source is always one. please tell me what am i doing wrong and how to solve this. thank you
AnswerRe: Need help with binding source Pin
Henry Minute6-Apr-09 12:08
Henry Minute6-Apr-09 12:08 
GeneralRe: Need help with binding source Pin
faizych6-Apr-09 12:34
faizych6-Apr-09 12:34 
GeneralRe: Need help with binding source Pin
Henry Minute7-Apr-09 1:58
Henry Minute7-Apr-09 1:58 
Questionpassing XML data between .NET exes Pin
dyNamite6-Apr-09 8:21
dyNamite6-Apr-09 8:21 
AnswerRe: passing XML data between .NET exes Pin
Jimmanuel6-Apr-09 8:36
Jimmanuel6-Apr-09 8:36 
GeneralRe: passing XML data between .NET exes Pin
dyNamite7-Apr-09 7:12
dyNamite7-Apr-09 7:12 
GeneralRe: passing XML data between .NET exes Pin
Jimmanuel7-Apr-09 12:12
Jimmanuel7-Apr-09 12:12 
GeneralRe: passing XML data between .NET exes Pin
dyNamite8-Apr-09 18:17
dyNamite8-Apr-09 18:17 
QuestionThreading & StreamReader.Read() Question Pin
Harvey Saayman6-Apr-09 7:47
Harvey Saayman6-Apr-09 7:47 
AnswerRe: Threading & StreamReader.Read() Question Pin
S. Senthil Kumar6-Apr-09 8:09
S. Senthil Kumar6-Apr-09 8:09 
GeneralRe: Threading & StreamReader.Read() Question Pin
Harvey Saayman6-Apr-09 8:51
Harvey Saayman6-Apr-09 8:51 
AnswerRe: Threading & StreamReader.Read() Question Pin
Luc Pattyn6-Apr-09 8:30
sitebuilderLuc Pattyn6-Apr-09 8:30 
Questionhow to transfer binary files ? Pin
E_Gold6-Apr-09 7:05
E_Gold6-Apr-09 7:05 
AnswerRe: how to transfer binary files ? Pin
Luc Pattyn6-Apr-09 7:23
sitebuilderLuc Pattyn6-Apr-09 7:23 
GeneralRe: how to transfer binary files ? Pin
EliottA6-Apr-09 9:16
EliottA6-Apr-09 9:16 
GeneralRe: how to transfer binary files ? Pin
Luc Pattyn6-Apr-09 9:34
sitebuilderLuc Pattyn6-Apr-09 9:34 
AnswerRe: how to transfer binary files ? Pin
jschell6-Apr-09 8:16
jschell6-Apr-09 8:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.