Results 1 to 9 of 9

Thread: Setting value og txtboxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    11

    Setting value og txtboxes

    Hi,

    How do I set a value for a textbox? In VB6 you could for example say that me.txtMybox = txtMybox + 1 because it automatically assumed that I'm looking for it's value. I could write "1" in the textbox and it would retrieve that value.

    In VB.NET you have to specify the value, or set it, I don't know.

    The problem is the above code obviously doesn't work, any suggestions is much appreciated!


    In advance, thanx for your help.

    : Todd

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Use textbox.text = 1
    Dont gain the world and lose your soul

  3. #3
    Hyperactive Member Hampster's Avatar
    Join Date
    Feb 2001
    Location
    On my hamster wheel.
    Posts
    374
    Try:
    VB Code:
    1. TextBox.Text = TextBox.Text + 1

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Or
    Me.Text1.Text = int.Parse(Me.Text1.Text) + 1

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    11

    Error messege

    hellswraith :"Overload resolution feiled because no accesible "Int" accepts this number of arguments"

    Suggestions? Any fewer arguments?

    :Todd

  6. #6
    Hyperactive Member Hampster's Avatar
    Join Date
    Feb 2001
    Location
    On my hamster wheel.
    Posts
    374
    Originally posted by DevGrp
    Use textbox.text = 1
    Originally posted by Hampster
    Try:
    VB Code:
    1. TextBox.Text = TextBox.Text + 1
    Did those not work?

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    11

    Thanx

    Well... umm... I didn't work the last time I tried it

    Thanx a lot Hamster!!

    "Housten, we have lift off"

    : Todd

  8. #8
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    lol no use this instead:

    VB Code:
    1. TextBox1.Text += 1

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    11

    oki?

    Why? += as far as I have read sets the end value as the first value. I get the point but why do this, what are the advantages over just using + ...?

    Thanx.

    : Todd

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