Results 1 to 5 of 5

Thread: Need VBScript Help

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    2

    Question

    Does anyone know how to "swap" the text in textbox 1 with
    the text in textbox 2 on a form using only one line of
    vbscript code?

  2. #2
    Member
    Join Date
    May 2000
    Posts
    45
    It's impossible

    Now why do you want to do it in only 1 line?
    K

    ----------------------------------
    VB6 Ent SP4 Win2K Pro Platform SDK

  3. #3
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Cool

    dim txt1, txt2:txt1 = textbox1.text:txt2 = textbox2.text:textbox1.text = txt2:textbox2.text = txt1

    (Please note this IS one line of code. Don't know if it'll word wrap or not so I thought I'd tell you that)


    kleve: It's not impossible... There's just no point in doing it. however if somebody can give us one, let us know.

  4. #4
    Member
    Join Date
    May 2000
    Posts
    45
    Ok, it's possible to do it in one line of code, by putting ":"'s in. IMHO that's cheating

    What you've really got is 5 separate execution statements. To me a statement is a line of code, but I agree that it can be done in a single line, not a single execution statement.

    I'd still like to know why thou
    K

    ----------------------------------
    VB6 Ent SP4 Win2K Pro Platform SDK

  5. #5
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Cool

    He re-posted this in a new thread, and explained that he was looking for this because his professor said it was possible and he wanted to know how.

    You can also create your own function.

    Function SwitchBox(Text1, Text2)
    dim txt1
    txt1 = text1.text
    text1.text = text2.text
    text2.text = txt1
    end function

    Then call in code.

    SwitchBox TextBox1, TextBox2

    Of course, I realize this is not really on line of code, but I guess that just depends on how you look at it.

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