Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox

Status
Not open for further replies.

lothos12345

Programmer
Mar 8, 2005
40
US
Using visual basic I want to prevent the user from entering '*' into a textbox. How can this be done? Any help offered is greatly appreciated.
 
try the keypress event and the e from eventargs has all the secrets.

for example

e.cancel
e.keychar



Christiaan Baes
Belgium

"My new site" - Me
 
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = "*" Then
e.Handled = True
End If
End Sub

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Now you spoiled it.

Sometimes I feel that's my role in life. My wife certainly thinks so....

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top