|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to get the index selected in the datagrid tableHow to get the index selected in the datagrid table which contains the employees table information ,on getting the index who to update the record at that index in to other table
--- Posted via DotNetSlackers.com Hi!
If you want to get current row index from datagrid and then get this row from DataTable you can use following code: private BindingManagerBase bindingManagerBase; public Form1() { ...... ...... //-----get binding context here-------------// bindingManagerBase = dataGrid1.BindingContext[dataTable1]; } //---------then you can use bindingManagerBase.Position to get row from DataTable. Better to get row form DataView, because rows in DataGrid can be sorted, filtered and etc... void SomeMethod() { dataTable1.DefaultView[bindingManagerBase.Position]["column1"] = 6; } Best Regards, Michael Milonov http://www.snotratech.com Show quote > How to get the index selected in the datagrid table which contains the employees table information ,on getting the index who to update the record at that index in to other table > --- > Posted via DotNetSlackers.com |
|||||||||||||||||||||||