|
-
May 7th, 2008, 08:06 PM
#1
Validating a text box
hi! i want to make validation on a text box so that the first character is only A, B, C, or X..
Code:
sCustomerAccountNumber = txtCustomerAccountNumber.text
If sCustomerAccountNumber.Chars(0) <> Chr(65) Then
sErrorMessage = sErrorMessage & "Customer Account Number should start with a letter!" & vbCrLf & "e.g. A, B, C or X" & vbCrLf & "e.g. A1234567" & vbCrLf
bErrorOccurred = True
ElseIf sCustomerAccountNumber.Chars(0) <> Chr(66) Then
sErrorMessage = sErrorMessage & "Customer Account Number should start with a letter!" & vbCrLf & "e.g. A, B, C or X" & vbCrLf & "e.g. A1234567" & vbCrLf
bErrorOccurred = True
ElseIf sCustomerAccountNumber.Chars(0) <> Chr(67) Then
sErrorMessage = sErrorMessage & "Customer Account Number should start with a letter!" & vbCrLf & "e.g. A, B, C or X" & vbCrLf & "e.g. A1234567" & vbCrLf
bErrorOccurred = True
ElseIf sCustomerAccountNumber.Chars(0) <> Chr(88) Then
sErrorMessage = sErrorMessage & "Customer Account Number should start with a letter!" & vbCrLf & "e.g. A, B, C or X" & vbCrLf & "e.g. A1234567" & vbCrLf
bErrorOccurred = True
End If
what happens with these code is whenever i try to put in A, B, C, or X.. i get the error message.. should i convert this into a loop..??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|