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)

Syntax

public void CancelEdit()
public:
void CancelEdit()
member CancelEdit : unit -> unit
Public Sub CancelEdit

Remarks

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.

Examples

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();
    }
}
Private Sub ProductNameTextBox_KeyDown(
    ByVal sender As Object, 
    ByVal e As System.Windows.Forms.KeyEventArgs
  ) Handles ProductNameTextBox.KeyDown

    If e.KeyCode = Keys.Escape Then
        DataRepeater1.CancelEdit()
    End If
End Sub

See Also

DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)

Return to top