DataGridViewRow.GetContextMenuStrip(Int32) Method
In this article
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the shortcut menu for the row.
public:
System::Windows::Forms::ContextMenuStrip ^ GetContextMenuStrip(int rowIndex);
public System.Windows.Forms.ContextMenuStrip GetContextMenuStrip(int rowIndex);
public System.Windows.Forms.ContextMenuStrip? GetContextMenuStrip(int rowIndex);
member this.GetContextMenuStrip : int -> System.Windows.Forms.ContextMenuStrip
Public Function GetContextMenuStrip (rowIndex As Integer) As ContextMenuStrip
- rowIndex
- Int32
The index of the current row.
A ContextMenuStrip that belongs to the DataGridViewRow at the specified index.
rowIndex
is -1.
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
.
Applies to
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |