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

Username:   Password: 
 RegisterRegister   
 Need help creating random values that can't be repeated
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
blizzard4800




PostPosted: Sun Jun 05, 2011 10:44 pm   Post subject: Need help creating random values that can't be repeated

I need help assigning random values to different to buttons which are supposed to have values.
If you still don't understand it is for a deal or no deal project where the cases( which are buttons) have different values.
Sponsor
Sponsor
Sponsor
sponsor
Nick




PostPosted: Sun Jun 05, 2011 10:48 pm   Post subject: RE:Need help creating random values that can\'t be repeated

do you have your buttons in a control array?

if so, in your form.load event just have a for each loop and assign a value to each button's tag property.
blizzard4800




PostPosted: Sun Jun 05, 2011 10:50 pm   Post subject: RE:Need help creating random values that can\'t be repeated

no i dont have them in an array
Raknarg




PostPosted: Sun Jun 05, 2011 10:59 pm   Post subject: RE:Need help creating random values that can\'t be repeated

You should. There's two options here. The easier but more tedious way is to create 51 buttons, and assign an array to each button. Ex:

Dim tiles(51) As Button
tiles(1) = Button1
tiles(2) = Button2
etc...

Or you can create you own buttons. That's possible, it can just be a bit annoying to do. Ex:

dim tiles(51) As Button
For i = 1 to 51
Dim nb As Button
nb = New Button

(set all button parameters here)
Controls.Add(nb)
tiles(i) = nb
Next
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  [ 4 Posts ]
Jump to:   


Style:  
Search: