InputBox Function: Type Mismatch Errors

InputBox Function: Type Mismatch Errors

I have written a small program that calculates geometry problems. I have used input boxes to retreive data from the keyboard, however during runtime if I click the cancel button on the input box I get the error message “Type Mismatch”.This happens in the part of the program that does the calculations (After I’ve got the numbers to calculate).What do I do?

You are probably taking the value returned from InputBox and putting it directly into a calculation. You cannot always do this, since the box will be blank if the user presses Cancel. If you check the value against two double quotes first, that should get rid of the type mismatch.

See also  5 Tips for Working With an Onsite Interpreter

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist