This is probably the most fundamental thing to understand about data types.
When you type into a textbox, no matter what you type, it is treated as text
(string) since you typed it into a "text"box. When you use the "+" operand,
it is treated as string addition (concatenation), rather than numeric
addition.
You need to convert the values to a numeric type before doing the math. You
should also check to see IF the values typed into the textboxes are, in
fact, numeric BEFORE you attempt to convert them, since "Green" doesn't
convert to a numeral. VS.NET's range or regular expression validators can
ensure that only numerals are entered.
"Hareth" <ab******@hotmail.com> wrote in message
news:Ot**************@TK2MSFTNGP11.phx.gbl...
Scenerio:
label1.text = 0
textbox1.text = 0
textbox2.text = textbox1.text + label1.text
It turns out it isnt adding the numbers, it attaches the new number next
to the old number
if label1.text = 1 then textbox1 is = 2 then 1+2 = 3 ....it writes 1+2= 12
INSTEAD of 3