1
Reply

Comparing valid data input in VB

Victor

Victor

Jan 9 2009 7:09 PM
2.5k

I'm new to VB programming. I have two variables - one hrsWorked as String and hoursWorked as Double. I got hours worked from user into hrsWorked. I know VB can convert the inut string hrsWorked to hoursWorked for me if the user enters, say 45.8. But what if user enters the wrong input, say, "hello", instead of 45.8? I want to test to make sure that user did not enter "hello" or any other character string. How do I test the user input in hrsWorked or what VB function can I use to test it before I assign hoursWorked = hrsWorked?

Thanks for any comment/help


Answers (1)