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:
Dim strAction As String = txtAction.Text Select Case strAction Case "A" If IsNumeric(txtEmp.Text) = False Then MsgBox("Employee number must be a numeric value.", _ MsgBoxStyle.OKOnly, "Employee Number Error") txtEmp.Focus() Exit Sub End If If IsNumeric(txtDayCode.Text) = False Then MsgBox("This field must be a numeric value 1-7.", _ MsgBoxStyle.OKOnly, "Day Code Error") txtDayCode.Focus() Exit Sub End If If (txtJobNumber.Text) = "" Then MsgBox("The job number field can not be left blank.") txtJobNumber.Focus() Exit Sub End If If (txtPC.Text) = "" Then MsgBox("The Pc Field can not be left blank.") txtPC.Focus() Exit Sub End If If (txtTime.Text) = "" Then MsgBox("The time field can not be left blank.") txtTime.Focus() Exit Sub End If If (txtAmount.Text) = "" Then MsgBox("The amount field can not be left blank.") txtAmount.Focus() Exit Sub End If




Reply With Quote