Results 1 to 5 of 5

Thread: [RESOLVED] spilt list

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2017
    Posts
    147

    Resolved [RESOLVED] spilt list

    Code:
            For i = ListBox1.Items.Count - 1 To 0
                ListBox2.Items.Add(Split(ListBox1.Items.Item(i).ToString, ":")(0))
                ListBox3.Items.Add(Split(ListBox1.Items.Item(i).ToString, ":")(1))
            Next
    it doesn't throw a error, it just does nothing when i execute this code.. any ideas?

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: spilt list

    What is the value of ListBox1.Items.Count at the start?

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: spilt list

    Put a breakpoint on the For line and step through the code. It looks pretty reasonable, and you say it isn't throwing any exceptions, so you're going to have to dig a bit deeper. If this is in the Load Event handler (or a method called from the Load Event handler), then there is a chance the code isn't even running. The breakpoint would tell you that, because it might not be reached, or it might be reached, but when you step one line further it might just exit.

    Otherwise, when you step to the first Listbox2.Items.Add, then highlight the whole contents:
    Split(ListBox1.Items.Item(i).ToString, ":")(0)

    If you are seeing nothing, then that would be the problem, at which point you then highlight just:

    Split(ListBox1.Items.Item(i).ToString, ":")

    to see what that is returning, and so forth.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2017
    Posts
    147

    Re: spilt list

    it needed
    Code:
    step - 1
    sometimes the most obvious thing is missed.

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: [RESOLVED] spilt list

    Yep. Totally missed that one.
    My usual boring signature: Nothing

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