Results 1 to 4 of 4

Thread: sorting control arrays

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Location
    Huntington Beach, CA., USA
    Posts
    2

    sorting control arrays

    I have developed a scorecard program to keep the score in a game of dominos. I would like to add a function at the end of the game that will display who was in 1st place, 2nd place, 3rd place, etc. My program creates the labels that hold the player name and running score, and the text box that holds the score for the round on the fly as control arrays. I can use a bubble sort to sort the scores but how do I keep the name of the player with his or her score?
    Thanks

  2. #2
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: sorting control arrays

    Welcome to the forum!

    Have you used the controls Tag property?
    It's a great place to store info

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2008
    Location
    Huntington Beach, CA., USA
    Posts
    2

    Re: sorting control arrays

    here is how I load the total score into the label control:
    Code:
    For I = 0 to intNumberofPlayers -1
       intScore(I) = txtEnterScore(I).Text
       intTotalScore(I) = intTotalScore(I) + intScore(I)
       lblTotalScore(I).Caption = intTotalScore(I)
       txtEnterScore(I)=""
    Next
    this adds each players score for the current round to their total score and displays the score in the label TotalScore. My player names are held in txtPlayerName(I). Can I make lblTotalScore(I).tag = txtPlayerName(I)? Will the tag property have the player number, the player name, or ?

    thanks

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: sorting control arrays

    The tag property are string values. So you can pretty much make the tag represent anything. It would make sense to make it reference your txtPlayerName index.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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