-
ok, i know its dumb to ask, but how do i take a selected number from a listbox (EG List1.text would have it) and add it to annother listbox number and show the results in a label or textbox? i have been trying at this for about 2 hours now and nothing i have tried has worked.
Thanx
EDL, Archarzel
-
It looks simple, but it seems you are not telling the whole story. Anyway, supposing that the text proprety has only numbers (no spaces):
Code:
text1.text=cint(list1.text)+cint(list2.text)
I think this is it.
-
Code:
CCur Any valid expression to Currency
CDbl Any valid expression to Double
CInt Any valid expression to Integer
CLng Any valid expression to Long
CSng Any valid expression to Single
Try other functions if the number isn't integer.
-
well, i tried that, but it does the same thing, just puts in annother umber, 2+2 makes 22. :(
-
Are you sure you used the explicit casting functions the Goodreams mentioned? You are getting a string concatenation rather than an integer addition by the looks of it. The text property contains string data - make sure you cast this to a numeric data type like integer before you add it. Use code just like Goodreams suggested, but with your control names.
-
Try this:
text1.text=val(list1.text) + val(list2.text)
This must work.
-
Allright! it works, thanks :)
-
Shouldn't use val, it isn't local aware, use the functions Goodreams posted.