Export (0) Print
Expand All
Expand Minimize

DataRepeater.CancelEdit Method

Allows users to cancel an edit to the current child control in the current DataRepeaterItem.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public void CancelEdit()

Use this method to enable users to cancel their changes to child controls in a DataRepeater control. You must monitor the KeyDown events for the child controls to determine when the user has pressed the ESC key and call the CancelEdit method to return the control to its pre-edit state.

The following example demonstrates how to cancel an edit when the user presses the ESC key. It assumes that you have a form that contains a DataRepeater control named DataRepeater1 that contains a TextBox named ProductNameTextBox.

private void productNameTextBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    if (e.KeyCode == Keys.Escape)
    {
        dataRepeater1.CancelEdit();
    }
}

Show:
© 2015 Microsoft