Results 1 to 3 of 3

Thread: vs[2005] adding textboxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    10

    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

  2. #2
    New Member TirRaven's Avatar
    Join Date
    May 2007
    Posts
    14

    Re: vs[2005] adding textboxes

    Quote 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:
    1. 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

  3. #3
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: vs[2005] adding textboxes

    vb Code:
    1. 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
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width