Web Analytics Made Easy -
StatCounter [C#] BindingContext[...].Position not working - CodingForum

Announcement

Collapse
No announcement yet.

[C#] BindingContext[...].Position not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [C#] BindingContext[...].Position not working

    Hi,

    I am working on a window form app and have successfully bind the data to the controls with the following code

    Code:
    ....
    dsMail = new DataSet();
    sqlDataAdapter.Fill(dsMail, "myTable") ;
    DataTable dt = dsMail.Tables["myTable"];
    
    lstSub.DataSource = dt;
    lstSub.DisplayMember = "subject";
             
    txtMessage.DataBindings.Add(new Binding("Text",dt,"message"));
    but when I want to navigate the dataset dsMail through bindingContext.position (something like)

    Code:
    private void button2_Click(object sender, System.EventArgs e)
    {
    	this.BindingContext[this.dsMail, "myTable"].Position = anInteger ;
    }
    The controls do not reflect the change of position in the dataset.

    How can I change the contents of the control to show the "current record" in dataset?

    Many thanks.
Working...
X