DataGridViewCellCancelEventArgs.ColumnIndex 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得發生該事件之儲存格的資料行索引。
public:
property int ColumnIndex { int get(); };
public int ColumnIndex { get; }
member this.ColumnIndex : int
Public ReadOnly Property ColumnIndex As Integer
屬性值
發生該事件之 DataGridViewCell 的資料行索引。
範例
下列程式碼範例說明如何使用這個屬性。
private void dataGridView1_CellBeginEdit(object sender,
DataGridViewCellCancelEventArgs e)
{
string msg = String.Format("Editing Cell at ({0}, {1})",
e.ColumnIndex, e.RowIndex);
this.Text = msg;
}
private void dataGridView1_CellEndEdit(object sender,
DataGridViewCellEventArgs e)
{
string msg = String.Format("Finished Editing Cell at ({0}, {1})",
e.ColumnIndex, e.RowIndex);
this.Text = msg;
}
Private Sub dataGridView1_CellBeginEdit(ByVal sender As Object, _
ByVal e As DataGridViewCellCancelEventArgs) _
Handles DataGridView1.CellBeginEdit
Dim msg As String = _
String.Format("Editing Cell at ({0}, {1})", _
e.ColumnIndex, e.RowIndex)
Me.Text = msg
End Sub
Private Sub dataGridView1_CellEndEdit(ByVal sender As Object, _
ByVal e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellEndEdit
Dim msg As String = _
String.Format("Finished Editing Cell at ({0}, {1})", _
e.ColumnIndex, e.RowIndex)
Me.Text = msg
End Sub