|
-
Nov 26th, 1999, 01:53 PM
#1
Thread Starter
Junior Member
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.
-
Nov 26th, 1999, 02:01 PM
#2
Use the Random Number to set the Listboxes ListIndex Property, eg.
Code:
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
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|