I have a program where there are text boxes that accept values and then a command button is pressed. I need to know how to let the program check if the values entered are negative or anything that isn't a number. I also need the program to understand that if the text box is empty it should read that as a value of zero instead of just giving me a runtime error.

Recommended Answers

All 3 Replies

You can use the function IsNumeric to check if a certain string is numeric or not. It is numeric if it contains only numbers and only one "-" (negative sign). If no text is entered in the textbox, its text value is "". You can use If/Else selection for this.

commented: Thanks for the help. +7

Thanks for helping but now I have a few other problems with the same program. I don't know how to change a datatype from variant to currency part way through a program.

Nevermind. I figured out how to change datatypes. I finished the program. Thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.