|
-
Jun 25th, 2000, 10:48 PM
#1
Thread Starter
Addicted Member
My first question has to do with the random command, i have 30 command buttons, named Command## (## = any number 1-30. What I want to do is when randomcmd is clicked, it randomly selects 1-30 and performs the action of Command##.click
My second question is how would i open a program through my vb program, say Solitaire or the calculator, just click a button, and the program opens, thanks for your help!
-
Jun 25th, 2000, 11:01 PM
#2
Fanatic Member
Command Buttons.
You will need a control array, if you haven't already got one.
Then do
Code:
private sub randomcmd_click()
Dim i as integer
'find a random number between 1 and 30
Randomize
i = cint(rnd * 29) + 1
'call the click event with the index as the random num.
cmdCommandArray_Click(i)
End Sub
cmdCommandArray_Click(Index As Integer)
Select Case Index
Case = 1
'do something
Case = 2
'do something
'blah blah blah
End Select
Ens Sub
To run a program you will need to use "Shell" or "ShellExecute"
Iain, thats with an i by the way!
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
|