Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 a little help with a for loop
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Drewbie




PostPosted: Fri Jan 26, 2007 9:22 pm   Post subject: a little help with a for loop

im tyring to get this loop to work but cant quite figure it out

Dim i As Integer
For i = 1 To 6
Label(i).Caption = Int(Rnd * 10 + 1)
Next

what i want it to do i to cycle threw the labels on my form and generate a number in each one
but i dont know how to get it to switch from label to label
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Fri Jan 26, 2007 9:49 pm   Post subject: Re: a little help with a for loop

are your labels made a control array?

Edit: i just tried your code which is correct by making a control array and it works. so all you have to do is make a control array
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: