DataGridView.CellBeginEdit DataGridView.CellBeginEdit DataGridView.CellBeginEdit DataGridView.CellBeginEdit Event

Definición

Tiene lugar cuando el modo de edición comienza por la celda seleccionada.Occurs when edit mode starts for the selected cell.

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 

Ejemplos

En el ejemplo de código siguiente se muestra cómo controlar este evento para reflejar que se DataGridViewCell está editando el actual.The following code example illustrates how to handle this event to reflect that the current DataGridViewCell is being edited. En este ejemplo, la Text propiedad de la colección Form contenedora se establece para reflejar la celda que se está editando.In this example, the Text property of the containing Form is set to reflect which cell is being edited. Para ejecutar este ejemplo, pegue el código en un formulario que contenga DataGridView un dataGridView1denominado y asegúrese de que todos los eventos estén asociados a sus controladores de eventos.To run this example, paste the code into a form that contains a DataGridView named dataGridView1, and ensure all events are associated with their event handlers.

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

Comentarios

Para obtener más información acerca de cómo controlar eventos, vea controlar y provocar eventos.For more information about how to handle events, see Handling and Raising Events.

Se aplica a

Consulte también: