Validating Event and GotFocus Event...possible bug
Try this out. Create a windows application. Drag 2 textboxes onto the form. Leave the default Text.
Handle the first textboxes validating event. If it's Text is empty, set CancelEventArgs.Cancel to True AND show a messagebox.
Run adn do something in TextBox1 that causes Cancel to get set to True. You should see the MessageBox.
Notice that Textbox2's GotFocus event is not suppressed. It should be IMHO.
Now, try the same test, this time use an ErrorProvider instead of a MessageBox:
Private Sub TextBox1_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
If Me.TextBox1.Text.Trim.Length = 0 Then
e.Cancel = True
Me.ErrorProvider1.SetError(Me.TextBox1, "Oops")
End If
End Sub
Private Sub TextBox2_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox2.GotFocus
MessageBox.Show("got focus")
End Sub
GotFocus is suppressed in this case. Interesting.