Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Caption at Random

Status
Not open for further replies.

rrjoyner

Programmer
Apr 26, 2002
2
US
How can I make the caption of a command button be different by clicking on another cmdButton using a For loop?

Ron
 
Your Q is vague but as far as i got u need to change the caption of command button on click of other command button
Say Command1,Command2
On Command1_Click Event
Command2.caption="New Caption" ''--> do u want this to be random caption?
Regards
Nouman
 
I would like Command2.Caption to be random with a For loop
"For a = 1 to 10"
"Randomize ?"
"Next a"
Do I need a Dim statment for "a"?
And how would I put the in the caption for Command2?
 
Dim Captions(10) as String

Private Sub Form_Load()
Randomize
Captions(0) = "whatever"
Captions(1) = "whateverthef*ckever"
Caption(2) = "uhuh"
etc...

Sounds like you want them to change randomly so use a Timer...


Private Sub Timer()

CommandX.Caption = Captions(Int(Rnd*10))

'and to make them change at random intervals

Timer.Interval = (Int(Rnd*12)+1) * 1000
'which will make them change at random intervals anywhere from 1 to 12 seconds






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top