|
-
Nov 9th, 2000, 09:09 AM
#1
Thread Starter
Junior Member
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
-
Nov 9th, 2000, 09:11 AM
#2
Fanatic Member
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
-
Nov 9th, 2000, 09:17 AM
#3
_______
<?>
'Or
Dim d As Integer
d = Val(Text1) + Val(Text2) + Val(Text3)
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 9th, 2000, 09:25 AM
#4
Thread Starter
Junior Member
thanks, it worked
altecjjf
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|