DEVPPL
http://www.devppl.com/forum/

Initial value of a text box VB
http://www.devppl.com/forum/viewtopic.php?f=57&t=13487
Page 1 of 1

Author:  enizag [ Thu Apr 30, 2009 12:02 pm ]
Post subject:  Initial value of a text box VB

Hi there,

I have an issue with an application I am writing, I get information from a database, put the values into a label, then add up all the label values.
I use the following code to intialise the labels (12 of) :

Code:
temp4 = main.ManualBonus1.contTarq2m1.Text
       If Not IsNumeric(temp4) Then _ main.ManualBonus1.contTarq2m1.Text = 0
temp4 = main.ManualBonus1.contTarq2m1.Text

I then add them up:
Code:
temp = CInt(temp1) + CInt(temp2) + CInt(temp3)....

But this is where the error occurs as sometimes they have the value "NaN" in them which stops the calulation working. The value coming in from the database is always a number.
I get the following error:

OverflowException was unhandled

the calculation is done on Form Load and if a textbox is altered, and is contained within a User Control.

Any help would be gratefully appreciated.

Cheers

Enizag

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/