Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

In VB 6.0 I used the KeyPress-Event to change user inputs.

 

E.g. when a textbox has the text "31.0" and the user hits the "2"-key, I changed the KeyAscii paramter to 0, because there is no 31th day in February.

 

E.g. when I didnt want that the user is able to type in german letter (like ä, ö , ü). I just changed the KeyAscii to 0.

 

In VB.net I am not able to change the e.Keycode paramter and in the KeyPress events the changes are already made. I think that I have to use the KeyDown method, but how can I change the Keycode?

Edited by Gagel
  • Moderators
Posted

You can use the Keypress to limit the input or compare the input...

If Not e.KeyChar.(more methods here) Then

 

you can also use the Validating event, and if you don't want to accept the input, you can...

e.Cancel = True

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...