Click to See Complete Forum and Search --> : click list box
Help ME
Nov 26th, 1999, 12:53 PM
ok. i got a thing where it pick a random number. now i need it to click the number in the list box. say like there a list box. it there 5 items in it. well it will pick a random number from1 to 5. it if 4 it will clikc the 4 item in the list box how do i do this.
thanks for your help.
Aaron Young
Nov 26th, 1999, 01:01 PM
Use the Random Number to set the Listboxes ListIndex Property, eg.
Private Sub Command1_Click()
Randomize Timer
List1.ListIndex = Int(Rnd * 19)
End Sub
Private Sub Form_Load()
Dim iIndex As Integer
For iIndex = 1 To 20
List1.AddItem "Item " & iIndex
Next
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.