Why is it that sometimes your databound WinForm controls don't seem to want to stay in sync?
Most likely you have a problem with the way you're databinding the controls.
There are two ways (two different syntaxes) to specify databinding for any
control and this results in two distinct binding objects. The problem is that
you can't mix and match ... you have to stay consistent throughout the
form.
So, in other words, if you bound your DataGrid with:
this.oGrid.DataSource = MyDataSet;
this.oGrid.DataMember = "MyTable";
Then you have to use the following syntax with TextBoxes:
this.txtLastName.DataBindings.Add("Text", MyDataSet, "MyTable.LastName")
But if you bound your grid with:
this.oGrid.DataSource = MyDataSet.Tables["MyTable"];
Then you use this syntax for TextBoxes:
this.txtLastName.DataBindings.Add("Text", MyDataSet.Tables["MyTable"], "LastName")
from a solution provided by Bonnie Berent in Message #1036479
|