Sdílet prostřednictvím


DataGridView.CellBeginEdit Událost

Definice

Nastane při spuštění režimu úprav pro vybranou buňku.

public:
 event System::Windows::Forms::DataGridViewCellCancelEventHandler ^ CellBeginEdit;
public event System.Windows.Forms.DataGridViewCellCancelEventHandler CellBeginEdit;
public event System.Windows.Forms.DataGridViewCellCancelEventHandler? CellBeginEdit;
member this.CellBeginEdit : System.Windows.Forms.DataGridViewCellCancelEventHandler 
Public Custom Event CellBeginEdit As DataGridViewCellCancelEventHandler 

Event Type

Příklady

Následující příklad kódu ukazuje, jak zpracovat tuto událost, aby odrážela, že aktuální DataGridViewCell je upravován. V tomto příkladu Text je vlastnost obsahující Form nastavena tak, aby odrážela, která buňka se upravuje. Pokud chcete tento příklad spustit, vložte kód do formuláře, který obsahuje pojmenovaný DataGridViewdataGridView1, a ujistěte se, že všechny události jsou přidružené k jejich obslužným rutinám událostí.

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

Poznámky

Další informace o zpracování událostí naleznete v tématu Zpracování a vyvolávání událostí.

Platí pro

Viz také