Question
November 6, 2007 at 08:13 AM
ahassan81

TextBox Casting and Validation

by ahassan81 . Updated 18 years, 11 months ago

Hi,

I have got 4 texboxes which should handle Double type numbers. At the access database in the back-end, I created them as Text data type. The program needs to multiply those 4 values to get a desired number. My 2 questions are:

1. I am trying to do the multiplication on the change handle of every text box, but I get an error which states that “Cast from string”” to type ‘Double’ is not valid”. I made sure that the initial value of the text box is not empty but I am not successful.

2. What is the best way to force the user to enter the numbers in a fraction format i.e. 0.XXXX. Because if a whole number is entered it would mess up the whole calculation.

Appreciate your help on this because I am new to VB.NET

Awaiting replies

This discussion is locked

All Comments