BindingContext[...].Position not working

M

michael_hk

Hi,

I am working on a window form app and have successfully bind the data
to the controls with the following 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:1:96b747d521]
private void button2_Click(object sender, System.EventArgs e)
{
this.BindingContext[this.dsMail,
"myTable"].Position = anInteger ;
}
[/code:1:96b747d521]

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.
 
G

Guest

It is todo with you binding to the DataTable but then getting the currency manager for the [ DataSet,Table
it actually treats these as two different context

try this...

this.BindingContext[dt].Position = anInteger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top