Results 1 to 6 of 6
  1. #1
    trevor206's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    324
    Reputation
    12
    Thanks
    107

    Loop through listbox [solved]

    ok so i want to "restart a listbox" what i mean is once it reaches the last item in the listbox i want it to go back to the beginning how would i do this? Thanks

  2. #2
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,858
    Reputation
    3438
    Thanks
    101,669
    My Mood
    Breezy
    I don't understand. Are you trying to clear it?
    ListBox1.Items.Clear
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.7.3
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  3. #3
    trevor206's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    324
    Reputation
    12
    Thanks
    107
    Quote Originally Posted by master131 View Post
    I don't understand. Are you trying to clear it?
    ListBox1.Items.Clear
    I am sorry I am not trying to clear it so I will try to describe it better. Ok so I have a listbox running off of a loop so the selected index keeps changing (The code for it to change:
    Code:
    listbox1.selectedindex +=1
    ) once it reaches the end the program crashes. So i was wondering how to make it go to
    Code:
    listbox1.selectedindex = 0
    or the beginning of the the listbox once it reaches the end of the listbox.

    I can try to re reword it if you still don't understand.

  4. #4
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    [highlight=vb.net]
    If ListBox1.SelectedIndex = ListBox1.Items.Count - 1 Then
    ListBox1.SelectedIndex = 0
    Else
    ListBox1.SelectedIndex += 1
    End If
    [/highlight]

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  5. The Following User Says Thank You to Jason For This Useful Post:

    trevor206 (08-27-2011)

  6. #5
    trevor206's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    324
    Reputation
    12
    Thanks
    107
    Thanks that worked just fine

  7. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Marked solved then.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

Similar Threads

  1. [Help]Removing item from listbox [solved]
    By pushdis15 in forum Visual Basic Programming
    Replies: 9
    Last Post: 04-14-2011, 08:47 PM
  2. [Help] Select all items in a ListBox [solved]
    By alvaritos in forum Visual Basic Programming
    Replies: 4
    Last Post: 04-13-2011, 10:02 AM
  3. [HELP] Adding all files in C:\ to listbox[/Solved]
    By flameswor10 in forum Visual Basic Programming
    Replies: 12
    Last Post: 01-13-2011, 11:15 PM
  4. [Help] Extract Filename From Listbox[Solved]
    By FatCat00 in forum Visual Basic Programming
    Replies: 7
    Last Post: 10-24-2010, 09:04 PM
  5. [Help]Reading filenames to a listbox[Solved]
    By nathanael890 in forum Visual Basic Programming
    Replies: 4
    Last Post: 08-14-2010, 11:44 AM