tman11580
12-20-2008, 04:30 AM
ok so i have a loop and it goes like this..with some privates
Private RF as integer 'means random flip, to randomize a number to appear into a label so when the user clicks it it displays a random number that they have to match
Private Flip(16) as integer 'array for 16 numbers to randomize
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
Dim x As Integer
For x = 1 To 16
RF = Int(Rnd(Flip(x) * 16))
If RF = 1 Then Flip(1) = "1"
If RF = 2 Then Flip(2) = "2"
If RF = 3 Then Flip(3) = "3"
If RF = 4 Then Flip(4) = "4"
If RF = 5 Then Flip(5) = "5"
If RF = 6 Then Flip(6) = "6"
If RF = 7 Then Flip(7) = "7"
If RF = 8 Then Flip(8) = "8"
Label3.Text = Flip(RF)
Next
im making a matcing game and im stuck on this loop, its not randomizing correctly..this loop is to randomize an aray "Flip(16)" i have to randomize it and display it in a label..please help if u need more info on it just message or wutever..i know it should go up to 16 just too lazy to do it right now, i will do it when i get the loop right, also i know that im doing something wrong, its not so much supposed to randomize the number, it supposed to randomize which label the number goes in so the matching game isnt the same ever time you play, if anyone can help with that i would appriciate it.
Thanks
Private RF as integer 'means random flip, to randomize a number to appear into a label so when the user clicks it it displays a random number that they have to match
Private Flip(16) as integer 'array for 16 numbers to randomize
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
Dim x As Integer
For x = 1 To 16
RF = Int(Rnd(Flip(x) * 16))
If RF = 1 Then Flip(1) = "1"
If RF = 2 Then Flip(2) = "2"
If RF = 3 Then Flip(3) = "3"
If RF = 4 Then Flip(4) = "4"
If RF = 5 Then Flip(5) = "5"
If RF = 6 Then Flip(6) = "6"
If RF = 7 Then Flip(7) = "7"
If RF = 8 Then Flip(8) = "8"
Label3.Text = Flip(RF)
Next
im making a matcing game and im stuck on this loop, its not randomizing correctly..this loop is to randomize an aray "Flip(16)" i have to randomize it and display it in a label..please help if u need more info on it just message or wutever..i know it should go up to 16 just too lazy to do it right now, i will do it when i get the loop right, also i know that im doing something wrong, its not so much supposed to randomize the number, it supposed to randomize which label the number goes in so the matching game isnt the same ever time you play, if anyone can help with that i would appriciate it.
Thanks