November 12th, 2003, 02:05 AM
DataGrid - how to detect a row changed?
How can I detect in a C# program using a DataGrid, that the user selected a row? In VB there used to be a RowColChange event fired, but I cannot find a similar one in C#.
November 14th, 2003, 12:09 AM
try this in DataGrid's Click event,
System.Drawing.Point pt = this.PointToClient(Cursor.Position);
DataGrid.HitTestInfo hti = yourdatagrid.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
int row= hti.Row;
you can write a delegate/event when row is selected if you are making custom control out of it.
- Software Architect
Click Here to Expand Forum to Full Width