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. Splitting a text box with commas in it

Splitting a text box with commas in it

Scheduled Pinned Locked Moved Visual Basic
questionlounge
3 Posts 3 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

    Experts, I have a textbox which will generate a set of random numbers, e.g 10 , 4 , 6 , 3 , 2 , 1 .... What i need to do is to basically split this textbox up into lots of textboxes. I was originally using e.g

    txt1.text = mid(txt0.text, 1,txt0.textlength - 7)

    this was ok if you where using numbers below 10 but now i am not, so i have split my numbers using commas but how do i sort them into the differnet text boxes using the commas as splitting points? Many thanks Dan

    L W 2 Replies Last reply
    0
    • O offroaderdan

      Experts, I have a textbox which will generate a set of random numbers, e.g 10 , 4 , 6 , 3 , 2 , 1 .... What i need to do is to basically split this textbox up into lots of textboxes. I was originally using e.g

      txt1.text = mid(txt0.text, 1,txt0.textlength - 7)

      this was ok if you where using numbers below 10 but now i am not, so i have split my numbers using commas but how do i sort them into the differnet text boxes using the commas as splitting points? Many thanks Dan

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

      string.Split() is the prime choice for splitting strings by a special character of your choice. BTW: you would get into trouble if your numbers would exceed 999, your numbers include thousands separator, and your app were used by people using comma as a thousands separator (lots of West-European countries do this). :)

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


      Prolific encyclopedia fixture proof-reader browser patron addict?
      We all depend on the beast below.


      1 Reply Last reply
      0
      • O offroaderdan

        Experts, I have a textbox which will generate a set of random numbers, e.g 10 , 4 , 6 , 3 , 2 , 1 .... What i need to do is to basically split this textbox up into lots of textboxes. I was originally using e.g

        txt1.text = mid(txt0.text, 1,txt0.textlength - 7)

        this was ok if you where using numbers below 10 but now i am not, so i have split my numbers using commas but how do i sort them into the differnet text boxes using the commas as splitting points? Many thanks Dan

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

        Hi Dan, How's it going. Why don't you generate your list of random numbers into a List(of Integer). Then you can use the List(of Integer) to populate the rest of the text boxes. That way you don't need to split anything. Start using the powers of the .Net Framework and you will find programming so much easier, I promise. Cheers Wayne

        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