DataGrid::HitTestInfo::Row Property
.NET Framework (current version)
Gets the number of the row the user has clicked.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The following example prints the number of the clicked row and column by calling the HitTest method from within the MouseDown event of a System.Windows.Forms::DataGrid control. This returns a DataGrid::HitTestInfo object.
private: void dataGrid1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) { String^ newLine = "\n"; Console::WriteLine( newLine ); 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( "Column {0}", myHitTest->Column ); Console::WriteLine( "Row {0}", myHitTest->Row ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: