Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Método CurrencyManager.CancelCurrentEdit ()

 

Publicado: octubre de 2016

Cancela la operación de edición actual.

Espacio de nombres:   System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)

public override void CancelCurrentEdit()

This method is supported only if the objects contained by the data source implement the T:System.ComponentModel.IEditableObject interface. If the objects contained within the data source do not implement the T:System.ComponentModel.IEditableObject interface, changes made to the data will not be discarded.

System_CAPS_noteNota

This property was designed to be used by complex data-bound controls, such as the T:System.Windows.Forms.DataGrid control, to cancel edits. For example, when the user presses the ESC key, the M:System.Windows.Forms.CurrencyManager.CancelCurrentEdit method is called on the T:System.Windows.Forms.CurrencyManager for the T:System.Windows.Forms.DataGrid. Unless you are creating a control that requires this same functionality, you should not use this method. Instead, use the M:System.Data.DataRowView.CancelEdit method of the T:System.Data.DataRowView class.

The following code example uses the M:System.Windows.Forms.CurrencyManager.CancelCurrentEdit when the user presses the ESC key.

private void dataGrid1_KeyUp
(object sender, System.Windows.Forms.KeyEventArgs e)
{
   if(e.KeyCode == System.Windows.Forms.Keys.Escape){
      // Escape key pressed.
      CurrencyManager gridCurrencyManager = 
      (CurrencyManager)this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
      gridCurrencyManager.CancelCurrentEdit();
      MessageBox.Show("Escape!");
   }
}

.NET Framework
Disponible desde 1.1
Volver al principio
Mostrar: