OnValidating in editing control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philipp

    #1

    OnValidating in editing control

    Hi,

    I made my own DataGridViewEdi tingControl, DataGridViewCel l and
    DataGridViewCol umn.
    Is it possible to use an Onvalidating event in an editing control in a
    datagridview?
    I wrote something like this:
    Code:

    Protected Overrides Sub OnValidating(By Val e As
    System.Componen tModel.CancelEv entArgs)
    MyBase.OnValida ting(e)
    If Me.Text <String.Empty Then
    If Me.Text <"CORRECT"
    e.Cancel = True
    End If
    End If
    End Sub

    But when tabbing out the cell it gets executed twice plus that the incorrect
    value in the cell remains and the I can continue to edit in other cells.The
    event is correctly handled when I click somewhere else with the mouse (being
    the cursor remaining in the cell until a correct value is given).

    Do I need to do something special when the tab key is pressed.

    Any help is appreciated.

    Thanks in advance.


Working...