I have multiple textboxes that should have numeric values and others that need to have some kind of entry added. So far I have been doing it this way but I am wondering if there is a better way. How would you do this?
VB Code:
  1. Dim strAction As String = txtAction.Text
  2.         Select Case strAction
  3.             Case "A"
  4.                 If IsNumeric(txtEmp.Text) = False Then
  5.                     MsgBox("Employee number must be a numeric value.", _
  6.                           MsgBoxStyle.OKOnly, "Employee Number Error")
  7.                     txtEmp.Focus()
  8.                     Exit Sub
  9.                 End If
  10.                 If IsNumeric(txtDayCode.Text) = False Then
  11.                     MsgBox("This field must be a numeric value 1-7.", _
  12.                         MsgBoxStyle.OKOnly, "Day Code Error")
  13.                     txtDayCode.Focus()
  14.                     Exit Sub
  15.                 End If
  16.                 If (txtJobNumber.Text) = "" Then
  17.                     MsgBox("The job number field can not be left blank.")
  18.                     txtJobNumber.Focus()
  19.                     Exit Sub
  20.                 End If
  21.                 If (txtPC.Text) = "" Then
  22.                     MsgBox("The Pc Field can not be left blank.")
  23.                     txtPC.Focus()
  24.                     Exit Sub
  25.                 End If
  26.                 If (txtTime.Text) = "" Then
  27.                     MsgBox("The time field can not be left blank.")
  28.                     txtTime.Focus()
  29.                     Exit Sub
  30.                 End If
  31.                 If (txtAmount.Text) = "" Then
  32.                     MsgBox("The amount field can not be left blank.")
  33.                     txtAmount.Focus()
  34.                     Exit Sub
  35.                 End If