Hi all,

In some of my TextBoxes and editable ComboBoxes, I want to make sure that the end-user can only type characters and whitespace but not to allow whitespace without characters existing too.

I have started to write a public sub and would like to know the best way of accomplishing this scenario check. This is what I have so far. Your ideas are welcome.
vb Code:
  1. <CLSCompliant(True)> Public Sub WhiteSpaceAndLettersOnly(ByVal ctrl As Elegant.Ui.Control)
  2.         'This is going to be used on TextBoxes and editable ComboBoxes.
  3.         'This will not be used on txtWorkLog.
  4.         'Allow whitespace and letters only.
  5.         'Do not allow only whitespace without letters existing.
  6.         If TypeOf ctrl Is Elegant.Ui.TextBox Then 'TextBox.
  7.             If Not ctrl.Name Is "txtWorkLog" Then 'Not txtWorkLog.
  8.                 If Not String.IsNullOrEmpty(ctrl.Text) Then 'Isnt empty.
  9.  
  10.                 End If
  11.             ElseIf TypeOf ctrl Is Elegant.Ui.ComboBox Then
  12.                 If DirectCast(ctrl, Elegant.Ui.ComboBox).Editable = True Then
  13.  
  14.                 End If
  15.             End If
  16.         End If
  17.     End Sub