jason said:
hi,
I am trying to bind a dataset to datagrid and textboxes (selected columns),
when you selected a row in datagrid, the textboxes controls should refresh.
thanks.
Previous assumes you know how to bind grid to dataset... Drop dataset on
form... select grid and set DataSource=someDataset, DataMember=someTable.
For textbox, select it, Data, DataBindings, Text set it to the
table/column (dropdown) you want. It'll automatically synch when you
change rows in the grid
You have to be consistent in the way you bind things as Chris Sells says...
// 1. Bind to data set + table.column == GOOD
textBox1.DataBindings.Add( "Text", someDataset, "TableName.ColumnName" );
// 2. Bind table + column == BAD!
textBox1.DataBindings.Add( "Text", someDataset.TableName, "ColumnName" );
Same goes for binding in the designer... DataSource=someDataset,
DataMember="TableName.ColumnName" (aka #1). This way there is only a
single instance of the BindingManager... and everything will stay
synched... otherwise you get multiple instances and things do work.
Best,
John