Capture value in datagrid

  • Thread starter Thread starter Dave Petersen
  • Start date Start date
D

Dave Petersen

In my C# winforms datagrid, how do I get the value of the selected cell? In
asp.net I can use:

dataGrid1.SelectedIndex

but SelectedIndex is not available in windows forms apps. HitTestInfo will
return the cell number and row number, but I need to get the actual contents
of the cell.

Thanks,
Dave
 
Use the Item property (which is the indexer in C#) to retrieve the value of
any cell.
Coordinates of the currently selected cell can indeed be obtained as
suggested by AirPete.
 
Back
Top