Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


DataGridViewCell.RowIndex Property

Definition

Gets the index of the cell's parent row.

[System.ComponentModel.Browsable(false)]
public int RowIndex { get; }

Property Value

The index of the row that contains the cell; -1 if there is no owning row.

Attributes

Examples

The following code example illustrates the use of this property.

private void getCurrentCellButton_Click(object sender, System.EventArgs e)
{
    string msg = String.Format("Row: {0}, Column: {1}",
        dataGridView1.CurrentCell.RowIndex,
        dataGridView1.CurrentCell.ColumnIndex);
    MessageBox.Show(msg, "Current Cell");
}

Remarks

When the RowIndex property returns -1, the cell is either a column header, or the cell's row is shared.

For more information about row sharing, see Best Practices for Scaling the Windows Forms DataGridView Control.

Applies to

Termék Verziók
.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

See also