I am desgining a userform in ArcMap, but I don't know how to sum up numeric values in a textbox (txtBox1) in another textox (txtBox2). Can anybody provide me with a vba code for that!
Jambaly
0
Newbie Poster
Recommended Answers
Jump to PostSince you are using textbox, the data that you will input into it is treated as text. Therefore, you need to convert it to numeric value in able to do the summing.
I think, you can use the VAL function to do that.Can you give an example output?
Jump to Post-->>Asumming that you have a command button named Sum...
-->>Then under its event click,just try to code the following...Private Sub Sum_Click() txtBox2.Text = Val(txtBox2.Text) + Val(txtBox1.Text) End Sub
-->>If I did understand the question "I am desgining a userform in ArcMap,..." becouse I dont know …
Jump to PostYou can use the following then.
Dim x As Integer ''Will hold the amount, must be only in numbers, otherwise use x as string... ''Do the calculation BEFORE you add the next amount to your textbox. If you were using a listbox, it would have been much …
Jump to PostMy bad, there is a comment after the 10. Should be...
x = x + 10 ''The first amount, then the second etc...
I have no idea what you mean by
How we would relate these codes to Text1.text and command button
Please give …
All 16 Replies
green_ning
0
Newbie Poster
Jambaly
0
Newbie Poster
Bile
10
Newbie Poster
Jambaly
0
Newbie Poster
AndreRet
526
Senior Poster
Jambaly
0
Newbie Poster
AndreRet
526
Senior Poster
Jambaly
0
Newbie Poster
AndreRet
526
Senior Poster
Jambaly
0
Newbie Poster
AndreRet
526
Senior Poster
Jambaly
0
Newbie Poster
AndreRet
526
Senior Poster
Jambaly
0
Newbie Poster
AndreRet
526
Senior Poster
Vicky_4
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.