lblWkTotal1.text = lblSatTotal.text + lblSunTotal.text + lblMonTotal.text + lblTueTotal.text + lblWedTotal.text + lblThuTotal.text + lblFriTotal.text
If I run this line of code, I'm getting this error message: Cast from string "" to type 'Decimal' is not valid.
lblWkTotal1.text = CDec(lblSatTotal.text) + CDec(lblSunTotal.text) + CDec(lblMonTotal.text) + CDec(lblTueTotal.text) + CDec(lblWedTotal.text) + CDec(lblThuTotal.text) + CDec(lblFriTotal.text)
Any ideas how to correct the problem.
Thanks
Try changing from cDec to cDbl
Hi
Try usingCInt(TxtboxName.text).
Thanks David
When I change it to CDbl the followuing messages are generated:
[FormatException: Input string was not in a correct format.]
[InvalidCastException: Cast from string "" to type 'Double' is not valid.]
Any ideas where to go from here?
Franco
David
Changing to CDbl works OK if I first set the default text to 0.
Thanks for the suggestion.
Franco
Try forcing the result to a string
textBox.Text = CStr(Cint(blah) + CInt(Blah))
or
Dim i as Int32
i = CInt(Blah) + ...
textBox.Text = i.ToString()
0 comments:
Post a Comment