listbox and text box and timer control
hi all...
seems like i am forever asking questions but that in itself leads to knowledge
i am in need of a timer to loop through a listbox and start from the bottom of the list or top , ldisplaying each item the textbox one at at a time until it reaches the last or first item in the list box .. but the only thing is that the listbox count will vary
ie. a shopping list which displays all entries in a textbox one ata time
it shall display .. sugar and after a few seconds will display th enxt item
coffee
pause
tea
and so on
please help
many thanks
Rob
[619 byte] By [
Spumbu1977] at [2007-11-11 8:09:46]

# 1 Re: listbox and text box and timer control
Here's an example: I have a form Form1, a listbox list1, a textbox text1, a button Command1 and a timer control Timer1:
Option Explicit
Dim intIndex As Integer
Private Sub Command1_Click()
Text1.Text = ""
intIndex = 0 'Start listbox pos 1
Timer1.Interval = 1000 'Wait 1 sec
End Sub
Private Sub Form_Load()
Form1.List1.AddItem "Sugar"
Form1.List1.AddItem "Coffee"
Form1.List1.AddItem "Cookies"
Form1.List1.AddItem "Milk"
End Sub
Private Sub Timer1_Timer()
Form1.List1.ListIndex = intIndex
Form1.Text1.Text = Form1.List1.Text
intIndex = intIndex + 1
If intIndex = Form1.List1.ListCount Then Timer1.Enabled = False
End Sub
Let me know if it works for you.