Is there a way to control the KeyChar from an InputBox? If so, can you point me in the right direction? I know I can do it with a textbox but wasn't sure if possible with an inputBox. Thanks in advance!
Printable View
Is there a way to control the KeyChar from an InputBox? If so, can you point me in the right direction? I know I can do it with a textbox but wasn't sure if possible with an inputBox. Thanks in advance!
at least not at runtime.. but when the user press's ok you could look at the output and give an error message and promt to input again... i would advise to not use input boxes if you plan to restrict keys... keeps everything simple and nice... (my opinion)...
The only possible way I see it is somehow catching keys that get sent to your program while the input box is up, and editing the ascii so that when it's invalid set the ascii to 0 which is nothing. I'm not even sure that would work, but like c0rrupt said I wouldn't use an inputbox.
If you know how to do it with a textbox, then simply make a form that looks like an input box and put a text box on the form. Then use the DialogReturn property of the form to have the form return a value when DialogShow is called.