Numbers only please...

"Please enter a number between 1 and 100000"

Come on! Make it impossible to enter a character other than a number. Is that so hard? Or is there a reason for?

Reply to
Count Zero
Loading thread data ...

if not number < 1 and not number > 100000 then

msgbox "your number is greater the 1 and less then 100000"

else

msgbox "your number is not greater the 1 or not less then 100000"

end if

Reply to
Sean Phillips

Down With Polite Software!

I hate when they put please in there to somehow make you feel better for the anemic way in which the box accepts numbers.

Agreed-

SMA

OT: Are you CountZero[BOX] from Q2?

Reply to
Sean-Michael Adams

you need at least some non-numeric characters--

1.0 1.0 in 1.0 mm 87mm - 1.05 in

are all valid inputs

Reply to
Michael

I have used: ... On Error GoTo EntryError ... Num = CInt(Entered_Value) ... Exit Sub EntryError: Messages = "Error: Only numbers allowed, try again" ... End Sub

Of-course you can modify the code to take care of the mm/in/m/cubits part of the entered text. Much more sophisticated possibilities are possible with C++ etc...

Regards,

mvk

Reply to
Vinodh Kumar M

If Q2 means Quake2, yes, that was (is) my alias. From the text adventure "Count Zero" in DOS, waaaaayyy back.

Reply to
Count Zero

' I use something like the following: Private Sub Text1_KeyPress(KeyAscii As Integer) NumericChars = Array(8, 43, 45, 46, 48, 49, 50, 51, 52, 53, 54,

55, 56, 57) For I = 0 To UBound(NumericChars) If NumericChars(I) = KeyAscii Then Exit Sub Next I KeyAscii = 0 End Sub

I can then use different 'filters' depending on what I want to allow the users to enter into the textbox

Reply to
rocheey

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.