|
-
Oct 15th, 2011, 06:46 AM
#1
Thread Starter
New Member
Getting list number from variable
Code:
For j = 1 To 12
For i = 1 To 31
Randomize
x = Int(Rnd * 13 + 1)
winner(j, i) = x
Listj.AddItem winner(j, i)
Next i
Next j
How can i accomplish adding the numbers to different Listboxes? The number of list depends on the counter of the outer for cycle (So i want to put 31 random numbers to different ListBoxes, e.g. List1, List2, .. List12)
Edit: Actually if there's a simple way to show these data in a table, that would do it too.
-
Oct 15th, 2011, 08:01 AM
#2
Re: Getting list number from variable
Please explain the rules of the game.
BTW, Randomize should only be called once
at the beginning of program run, not in a loop.
-
Oct 15th, 2011, 08:03 AM
#3
Re: Getting list number from variable
Code:
Me.Controls("List" & j).AddItem winner(j, i)
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Oct 15th, 2011, 08:14 AM
#4
Re: Getting list number from variable
Here is a loop that will add odd numbers to listbox1 and even numbers to listbox2:
vb Code:
For j = 1 To 12 For i = 1 To 31 Randomize x = Int(Rnd * 13 + 1) winner(j, i) = x If j / 2 = int(j / 2) Then ListjEven.AddItem winner(j, i) Else ListjOdd.AddItem winner(j, i) EndIf Next i Next j
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Oct 15th, 2011, 08:44 AM
#5
Thread Starter
New Member
Re: Getting list number from variable
 Originally Posted by akhileshbc
Code:
Me.Controls("List" & j).AddItem winner(j, i)
Thanks, this one has really worked!
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
|