Hi,
I would like to have a row selected when i right click on a control. However, i cannot find how to get the row based on the point of the mouse_up event.
I searched the docs, but could not find any member of datagridview that could help me with that. I think i'm overlooking something.
Ward

DataGridView: Get row at point
Isaac1
Thanks...
saj14saj
The x and y variables are coordinates that you can easily retrieve via the Mouse property
This returns a HitTestInfo object that contians info such as rownumber and columnnumber
goodluck !
Offir
Right-click does not automatically select the row (selectmode is currently fullrow), so currentcell does not have the needed value.
Ward
smokeb
Chris Mullins
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
// Use the DataGrid control's HitTest method with the x and y properties.
myHitTest = dataGrid1.HitTest(e.X,e.Y);
Console.WriteLine(myHitTest);
Console.WriteLine("Column " + myHitTest.Column);
Console.WriteLine("Row " + myHitTest.Row);
Console.WriteLine("Type " + myHitTest.Type);
Console.WriteLine("ToString " + myHitTest.ToString());
Console.WriteLine("Hit " + myHitTest.Type.ToString());
Ward
R_s
Ward