Results 1 to 4 of 4

Thread: URGENT- SOS-Help - Variables and Text boxes

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    URGENT- SOS-Help - Variables and Text boxes

    I have 3 variables and 10 text boxes. I will try my best to explain this! LOL

    I want an easy way to do this. If the value of Var1 = 2 then take the values of text box 1 and 2. If Var2 = 3 then take the value of text3, text4 and text5. If Var3 = 5 then take the value of Var6, Var7, Var8, Var9, Var10...

    Variable 1 should take the values from the sequence of text boxes appearing in the value of the variable...


    HELP HELP

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Yeah, it does sound like you've got yourself in a bit of a mess

    Have you got any code that you've been working with at the minute that we can have a look at?
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513
    I am not getting me responses, so let me try and reword this to excatly what I am trying to do:

    I have three soccer coaches identified by Var1, Var2 and Var3..

    I have 40 players with names which are listed in the text boxes from text1 to text40...

    I need to distribute the players under the coach according to the value appearing in the Var1, Var2 and Var3...

    Example:

    Var1 (Coach1) = 2 (needs two players) then take the value of the first two text boxes, Text1 and text2 and store the value into two seperate variables.

    Var2 (coach2) is = 3 then take the value of the next three text boxes , text3 text4 and text5 and store it into seperate variables..

    Var3 (coach3) needs 1 player.. then take the value of text6 and store it into a variable..

  4. #4
    New Member
    Join Date
    Aug 2002
    Location
    IL
    Posts
    4
    Instead of using Text1 to Text40, do something like this:
    Add a new textbox.
    Rename it txtPerson.
    Change the index value to 0.
    Then copy and paste that textbox.
    Now you have txtPerson(0) to txtPerson(39)
    Use 3 listboxs under 3 textboxs, each listbox/textbox combination can be a coach.
    Name the textbox's txtCoach(0), txtCoach(1) and txtCoach(2)

    For i = 0 To Int(txtCoach(0).Text) - 1
    lstCoach(0).AddItem txtPerson(i)
    Next i 'don't need i, but looks nice

    For i = txtCoach(0).Text To (Int(txtCoach(0).Text) + Int(txtCoach(1).Text) - 1)
    lstCoach(1).AddItem txtPerson(i)
    Next i

    For i = (Int(txtCoach(0).Text) + Int(txtCoach(1).Text)) To (Int(txtCoach(0).Text) + Int(txtCoach(1).Text) + Int(txtCoach(2).Text) - 1)
    lstCoach(2).AddItem txtPerson(i)
    Next i

    May look a little confusing, but I'll try to explain (I did this in 5 minutes)
    It starts after the last valued used, and continues to the next number. I subtract one (int(txtcoach(0).text)-1) because the very first value is 0, so going from 0 to 4 would use 5 textboxes.
    I'm sure you're confused, but message back any questions.

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