Using VB 2010 Express.

I am unsure if this is the best way to validate a User's entry into a Textbox and especially don't understand whether or not to use "e.Cancel = True" if an error occurs.

Need some advice. Thanks!


Questionable Code:
  1. Private Sub MgrPasswordTextBox_GotFocus(sender As System.Object,
  2.                     e As System.EventArgs) Handles MgrPasswordTextBox.GotFocus
  3.         MgrPasswordTextBox.BackColor = Color.LightGreen
  4.     End Sub
  5.  
  6.  
  7.     Private Sub MgrPasswordTextBox_Validating(sender As System.Object,
  8.                     e As System.ComponentModel.CancelEventArgs) Handles MgrPasswordTextBox.Validating
  9.  
  10.         If MgrPasswordTextBox.Text > "" Then
  11.             ErrorProvider1.SetError(MgrPasswordTextBox, "")
  12.             MgrPasswordTextBox.BackColor = Color.White
  13.         Else
  14.             Beep()
  15.             e.Cancel = True
  16.             ErrorProvider1.SetError(MgrPasswordTextBox, "Enter a Password")
  17.             MgrPasswordTextBox.Select()
  18.         End If
  19.     End Sub
  20.     '*******************************************************************************************************