Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Data Binding a TextBox to a DataSet

woaksiewoaksie Member Posts: 1
I created a windows form. I added a SQLConnection, a SQLDataAdaptor, a DataSet all via the designer. I then added a TextBox and a ListBox and databound them both to a column in the DataSet. I then added a button that will show the next record with the following code;

this.BindingContext[this.dsPeople1.People].Position ++;

When I run this the ListBoxs selected line moves to the next record but the TextBox stays on the first record. Am I missing something?

This is the code that has been generated for the TextBox and the ListBox.

this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsPeople1, "People.First_Name"));

this.listBox1.DataSource = this.dsPeople1.People;
this.listBox1.DisplayMember = "First_Name";


Sign In or Register to comment.