VB: how do I prevent crashing if a numeric input is a letter
VB: how do I prevent crashing if a numeric input is a letter
(OP)
I am writing a VB program and am in the process of idiot proofing it. I have a section that requests a numeric input then does some calculations later with that number. I would like to prevent the calculation from taking place if a non-numeric character has been entered.
How do I do this?
How do I do this?





RE: VB: how do I prevent crashing if a numeric input is a letter
And put some error handling in to prevent the crashes.
RE: VB: how do I prevent crashing if a numeric input is a letter
CODE
Select Case KeyAscii
Case 8, 46, 48 To 57 'Backspace, decimal point & 0-9
Exit Sub
Case Else
KeyAscii = 0
Beep
End Select
End Sub
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
UK steam enthusiasts: www.essexsteam.co.uk
RE: VB: how do I prevent crashing if a numeric input is a letter
Jeff