-
I have a easy problem that i can't figure out, here is the code
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = a + b + c
Text4.Text = d
End Sub
The problem is if you enter a number into TEXT1,TEXT2,and TEXT3, the result is not added together.
Example: TEXT1 = 4
TEXT2 = 5
TEXT3 = 6
The resultis 456, but i need it to do the addition??
Any ideas??
Altecjjf
-
That's because they're strings, you need to convert them to numbers.
Code:
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = int(a) + int(b) + int(c)
Text4.Text = d
End Sub
-
<?>
'Or
Dim d As Integer
d = Val(Text1) + Val(Text2) + Val(Text3)
-
thanks, it worked
altecjjf