DataGridViewRow::GetContextMenuStrip Method (Int32)
.NET Framework (current version)
Gets the shortcut menu for the row.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- rowIndex
-
Type:
System::Int32
The index of the current row.
Return Value
Type: System.Windows.Forms::ContextMenuStrip^A ContextMenuStrip that belongs to the DataGridViewRow at the specified index.
| Exception | Condition |
|---|---|
| InvalidOperationException | rowIndex is -1. |
| ArgumentOutOfRangeException | rowIndex is less than zero or greater than or equal to the number of rows in the control minus one. |
Pass the GetContextMenuStrip method the indexer you used to retrieve the DataGridViewRow. Do not use the Index property for the rowIndex parameter. If the row is shared, Index is -1, which is an invalid value for rowIndex.
.NET Framework
Available since 2.0
Available since 2.0
Show: