lloyd123
August 10th, 2001, 04:39 AM
i have three text boxes and two command buttons. one command buttons add the values and the other takes away the values. i have got the take away command button to work but when i click on the add button istead of adding the value eg 10 + 10 = 20 it does 10 + 10 = 1010 please help
Andrew_Fryer
August 10th, 2001, 04:53 AM
Use
Int(Val1) + int(Val2)
Andrew
Cimperiali
August 10th, 2001, 05:07 AM
This is because content of a textbox is string.
text1.text = text1.text +10
is equal to
text1.text = text1.text & 10
you can write
(provided text1.text isnumeric)
text1.text = cint(text1.text) +10
or
text1.text = cdbl(text1.text) +10
or take suggest from previous reply...
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
Wojtek
August 10th, 2001, 09:09 AM
You can use:
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
it works also with non-integer values.
Wojtek