R
Rob Bradford
All.
I'm fairly new to VB.NET, can someone tell me why yhis fails to cast
properly? When Calc_Mileage is called I get he message;
"An unhandled exception of type 'System.InvalidCastException' occurred
in microsoft.visualbasic.dll
Additional information: Cast from string "" to type 'Decimal' is not
valid."
The text boxes are keystroke trapped to allow only numeric input plus
one "." character
The aim is to add the three figures togetrher display them in a text
box (this may /may not be enabled for input) and stort the value also
as a decimal.
Any help would be appreciated.
Rob.B.
Code snippet.
Dim End_Mileage As Decimal
Private Sub Calc_Mileage()
End_Mileage = CDec(Tb_Start_M.Text) + CDec(Tb_Business_M.Text)
+ CDec(Tb_Private_M.Text)
Tb_End_M.Text = CStr(End_Mileage)
Return
End Sub
I'm fairly new to VB.NET, can someone tell me why yhis fails to cast
properly? When Calc_Mileage is called I get he message;
"An unhandled exception of type 'System.InvalidCastException' occurred
in microsoft.visualbasic.dll
Additional information: Cast from string "" to type 'Decimal' is not
valid."
The text boxes are keystroke trapped to allow only numeric input plus
one "." character
The aim is to add the three figures togetrher display them in a text
box (this may /may not be enabled for input) and stort the value also
as a decimal.
Any help would be appreciated.
Rob.B.
Code snippet.
Dim End_Mileage As Decimal
Private Sub Calc_Mileage()
End_Mileage = CDec(Tb_Start_M.Text) + CDec(Tb_Business_M.Text)
+ CDec(Tb_Private_M.Text)
Tb_End_M.Text = CStr(End_Mileage)
Return
End Sub