Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I made my own DataGridViewEditingControl, DataGridViewCell and DataGridViewColumn.

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(ByVal e As System.ComponentModel.CancelEventArgs) 
  MyBase.OnValidating(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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...