English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

ok there's an input box right, and when you open the input box you can enter letters or numbers or special characters,(REMEMBER THIS IS NOT A TEXT BOX, ITS AN INPUT BOX.) I just want the user to insert numbers and decimals, but no letters or special characters. * Visual Basic 6.0 Professional***can you please include an example,thx!****

2006-11-05 06:58:23 · 2 answers · asked by hectexheat 1 in Computers & Internet Programming & Design

2 answers

In the keypress event of the input box write the following code

If (KeyAscii < 48) Or (KeyAscii > 57) Then KeyAscii = 0

2006-11-05 07:46:59 · answer #1 · answered by mat 1 · 0 1

The inputbox doesn't support what you are suggesting.

See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/c911e626-555a-41c5-8343-5e8b941469c4.asp

I suggest writing a custom input box using your own form so you can add a mask to the textbox.

Or simply validating the users input using IsNumeric() function.
See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/c911e626-555a-41c5-8343-5e8b941469c4.asp

2006-11-05 15:47:28 · answer #2 · answered by Wildjoe182 5 · 0 0

fedest.com, questions and answers