I have
1 listbox, 1 textbox, and 2 buttons (for start, and stop)
if I press the the buton for start the textbox will display (one by one) the items in listbox.. and if i press stop the textbox will stop displaying items..
is it possible? do i have to use a timer for this?
i think i have to use Do While (or Do until) Statement...but..hmmm i don't know.. :D
Guys Help Me...Thanks..

(sorry i am very poor in english)

You need a timer. You will also need a class variable to keep track of which item in the listbox is the next one to copy. When it gets to the last item the index will be reset to the first item. You don't need a loop. The iteration will be handled on each tick of the timer. If for any reason you do not want to create a class variable for the index you could alwyas store it in the Tag property of the listbox or textbox control.

.hmm.. .i am confused.. :(

here is what I'm trying to do:
i have 800+ items that are already stored on the listbox or on the listview..
the 1st item is already selected once i start the program..
then when i press the start button the timer will start and in every tick of the timer
you can see that the program will automatically selecting the items down to the last item..
and when i press stop the program will stop to selecting items.

i already know how to display selected item to a textbox
my problem now is how to implement my idea that is stated above..
could that be possible?

i am new in vb.net :(

but anyway thanks for the reply sir..
God Bless..


Surely possible. Let's say you have exactly 832 items in the listbox (or listview). That means the first item is accessed by


and the last item by


Where 831 is ListBox1.Items.Count - 1. If you have a class level index (let's call it currindex) then it is initialized to 0. Once you start your timer then the timer handler will

increment currindex

'if past the end of the list then wrap back to the first item

if currindex = ListBox1.Items.Count then
    currindex = 0
end if

copy text from ListBox1.Items(currindex) to the textbox

I find it almost always helps if you write out the problem steps in English (or whatever language suits you) and only then translate that into actual VB code. If you leave your pseudo-code in place you can just prefix all lines with ' and they become your comments in the code.

thanks a lot sir..
i set the listbox visible = false
and now i have a loading text(changing every .100 secs)..
that's what i want to do. lol. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.