|
-
Jun 22nd, 2007, 08:51 AM
#1
Thread Starter
New Member
vs[2005] adding textboxes
ok.. this sounds very stupid but i just forgot how to add more than 2 textboxes...my code looks something like this
....blablabla haldles button.click
dim number as integer
number = txta.text + txtb.text + txtc.text
it just doesnt work can u tell me how to do it properly im newb.
thank u
-
Jun 22nd, 2007, 08:58 AM
#2
New Member
Re: vs[2005] adding textboxes
 Originally Posted by Un33k
ok.. this sounds very stupid but i just forgot how to add more than 2 textboxes...my code looks something like this
....blablabla haldles button.click
dim number as integer
number = txta.text + txtb.text + txtc.text
it just doesnt work can u tell me how to do it properly im newb.
thank u
that code should work assuming that there is only integers in your textboxes. You can manually cast all the values to integers by doing:
vb Code:
number = convert.ToInt32(txta.text)+convert.ToInt32(txtb.text)+convert.ToInt32(txtc.text)
of course then you must do something with the variable number now that it contains the added values
-
Jun 22nd, 2007, 09:00 AM
#3
Re: vs[2005] adding textboxes
vb Code:
Dim number As Integer = Cint(txta.text) + Cint(txtb.Text) + Cint(txtC.Text)
You should look at Integer.TryParse to make sure that the text in the textboxes can actually be added
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
|