Export (0) Print
Expand All
Expand Minimize

DataGridView.CancelRowEdit Event

Occurs when the VirtualMode property of a DataGridView control is true and the cancels edits in a row.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public:
event QuestionEventHandler^ CancelRowEdit {
	void add (QuestionEventHandler^ value);
	void remove (QuestionEventHandler^ value);
}
/** @event */
public void add_CancelRowEdit (QuestionEventHandler value)

/** @event */
public void remove_CancelRowEdit (QuestionEventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

When the DataGridView is in virtual mode, changes are committed to the data cache at the cell level by default. The CancelRowEdit event can be used when implementing row-level transactions.

For more information about handling events, see Consuming Events.

The following code example illustrates how to handle this event for a DataGridView control in virtual mode. When the control is in edit mode, the rowInEdit variable holds the index of the row being edited, and the customerInEdit variable holds a reference to a Customer object corresponding to that row. When the user cancels out of edit mode, this object can be discarded. If the row the user was editing is the row for new records, however, the old Customer object is discarded and replaced with a new one so that the user can begin making edits again. This example is part of a larger example available in Walkthrough: Implementing Virtual Mode in the Windows Forms DataGridView Control.

No code example is currently available or this language may not be supported.

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 Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft