Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. TextBox needed to be lots of text boxes

TextBox needed to be lots of text boxes

Scheduled Pinned Locked Moved Visual Basic
game-devquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    offroaderdan
    wrote on last edited by
    #1

    Hi experts, How do i go about splitting a texbox with lots of information in it to lots of little ones. Initially what i want to do is perform a sort on a textbox thus having to split the textbox up to perform the sort. The textboxe is for a high score game so if someone does well they have the option of putting their name and the program will show the high score to everyone at the end. Is there any easy way to do this then having to split up the textbox, bearing in mind that the names vary from length to length - e.g dan to Patrick.... Many thanks Dan

    D W L 3 Replies Last reply
    0
    • O offroaderdan

      Hi experts, How do i go about splitting a texbox with lots of information in it to lots of little ones. Initially what i want to do is perform a sort on a textbox thus having to split the textbox up to perform the sort. The textboxe is for a high score game so if someone does well they have the option of putting their name and the program will show the high score to everyone at the end. Is there any easy way to do this then having to split up the textbox, bearing in mind that the names vary from length to length - e.g dan to Patrick.... Many thanks Dan

      D Offline
      D Offline
      Dalek Dave
      wrote on last edited by
      #2

      I would presume you would hold all the scores in an array, sorted by value each time a new score is added. Then show, say the top ten in the immediate text box by just filling in the top ten values from the array. I would use a Form if you wished to show all scores (or top 1000 or whatever).

      ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave

      1 Reply Last reply
      0
      • O offroaderdan

        Hi experts, How do i go about splitting a texbox with lots of information in it to lots of little ones. Initially what i want to do is perform a sort on a textbox thus having to split the textbox up to perform the sort. The textboxe is for a high score game so if someone does well they have the option of putting their name and the program will show the high score to everyone at the end. Is there any easy way to do this then having to split up the textbox, bearing in mind that the names vary from length to length - e.g dan to Patrick.... Many thanks Dan

        W Offline
        W Offline
        Wayne Gaylard
        wrote on last edited by
        #3

        You really should be more object oriented about all this. In Your backend you should create a User class that exposes 2 properties, Name and High Score. Let your class implement the IComparable interface, and in the CompareTo function just compare the high scores. In your Front End you can create a list of as many users as you think sufficient, call list.Sort(), and use an Object DataSource to bind to a listbox (or Textboxes if you must) displaying the list in order.

        1 Reply Last reply
        0
        • O offroaderdan

          Hi experts, How do i go about splitting a texbox with lots of information in it to lots of little ones. Initially what i want to do is perform a sort on a textbox thus having to split the textbox up to perform the sort. The textboxe is for a high score game so if someone does well they have the option of putting their name and the program will show the high score to everyone at the end. Is there any easy way to do this then having to split up the textbox, bearing in mind that the names vary from length to length - e.g dan to Patrick.... Many thanks Dan

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          I agree with zimvbcoder, you need a more structured approach. I suggest you create a Player class holding all relevant information; and a List<Player> holding your hall of fame. Then you can sort it; maybe this[^] will interest you. BTW: I would consider using a ListBox (with OwnerDraw mode) rather than a TextBox. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


          W 1 Reply Last reply
          0
          • L Luc Pattyn

            I agree with zimvbcoder, you need a more structured approach. I suggest you create a Player class holding all relevant information; and a List<Player> holding your hall of fame. Then you can sort it; maybe this[^] will interest you. BTW: I would consider using a ListBox (with OwnerDraw mode) rather than a TextBox. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


            W Offline
            W Offline
            Wayne Gaylard
            wrote on last edited by
            #5

            Hi Luc, sorry it's off topic a bit, but I just wanted to say thanks for that article. It helped me through some problems I had a while back in implementing the IComparable Interface. Taught me all I know on the topic to be precise. Many Thanks.

            L 1 Reply Last reply
            0
            • W Wayne Gaylard

              Hi Luc, sorry it's off topic a bit, but I just wanted to say thanks for that article. It helped me through some problems I had a while back in implementing the IComparable Interface. Taught me all I know on the topic to be precise. Many Thanks.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              I'm glad you liked it. :)

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


              I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups