DataGrid Woes

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Hello all:

What is the best way to get a reference to an item selected in a data
grid? What I am trying to do is have it so a user can select from a
list in a data grid of all our employees and then click a button to
update that employees details. What is the best way to accomplish this
so that you can then bind this data to the next form?

Thanks,

- John -
 
Hello John,

You should utilize CurrencyManager to get the data record corresponding to
the current position in the DataGrid.

CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataGrid.DataSource,
dataGrid.DataMember];
DataRowView currentRow = (DataRowView)cm.Current;
 
What does it mean if I get the following errow upon executing the code:

Cannot create child list for TableName.

- John -
 
Back
Top