I have a project in vb.net which i would like to create a program that a textbox will only allow alphabet,space and dots and it is in uppercase only.. no special character and numbers allowed. Thank you and God bless.. Hope to help me..
dearjoy
0
Newbie Poster
Recommended Answers
Jump to PostYou will have to make use of the textChanged event.
You will need to keep track of the key pressed also.
Create an array filled with all of the characters/keys you want to filter, then check against it with the key pressed.
If it passes,add it to the text box.
Jump to PostPrivate Sub TextBox2_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyUp If e.KeyCode < 65 Or e.KeyCode > 90 Then MsgBox("No Numbers please") TextBox2.Clear() Exit Sub End If End Sub
This code needs some make-up and decorations. Better first customize then use.
All 7 Replies
Begginnerdev
256
Junior Poster
bnitishpai
0
Newbie Poster
bnitishpai
0
Newbie Poster
G_Waddell
131
Posting Whiz in Training
brylle
-2
Junior Poster in Training
ome2012
2
Junior Poster in Training
ome2012
2
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.