validation of textbox

aditya12c

Active member
Joined
Aug 21, 2005
Messages
26
Programming Experience
Beginner
i have a textbox which can take only 4 character in it, in which 1st character entered bu user should be alphabet(a-z) and other three character should be numbers(0-9). how can i do it.

i was trying to use vb6 functions of


dim a as string
a=left("A001",1) // "A001" is what user typing in textbox
if a="A" then
msgbox("valid")
endif


but the above code is not working in vb.net or say i don know how to use it. if anyone can please tell me how to use it..
 
The left function is very obsolete. The substring() function is the knew version that replaced right, left and mid i believe. The substring function has two parameters start index and length both integers. Ex:

You have a text box (txtInput) and in this textbox the user typed "A" as the first character and any thing after. This would of course cause an error if the user passed an empty string but as you see it it should display working if the user types a capital A as the first character in the text box.

Dim a as string = txtInput.text.Substring(0, 1)
If a = "A" Then
msgbox("Working")
End If
 
Back
Top