Assembly: System.Windows.Forms (in system.windows.forms.dll)
/** @event */ public void add_EditingControlShowing (DataGridViewEditingControlShowingEventHandler value) /** @event */ public void remove_EditingControlShowing (DataGridViewEditingControlShowingEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
You can handle this event to perform custom initialization of the editing control when a cell enters edit mode. To customize the display characteristics of the control, set the properties of the object returned by the DataGridViewEditingControlShowingEventArgs.CellStyle property. To perform other initialization, cast the value of the DataGridViewEditingControlShowingEventArgs.Control property to the specific control type and access the members directly. For example, you can handle the EditingControlShowing event to attach event-handlers to the events of the editing control.
The DataGridView control hosts one editing control at a time, and reuses the editing control whenever the cell type does not change between edits. When attaching event-handlers to the editing control, you must therefore take precautions to avoid attaching the same handler multiple times. To avoid this problem, remove the handler from the event before you attach the handler to the event. This will prevent duplication if the handler is already attached to the event, but will have no effect otherwise. For more information, see the example code in the DataGridViewComboBoxEditingControl class overview.
For more information about handling events, see Consuming Events.
The following code example illustrates how to handle this event to change the BackColor property of the current cell. To run this example, paste the code into a form that contains a DataGridView named dataGridView1 and ensure that the EditingControlShowing event is associated with the event handler.
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.