Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


simple question


simple question

Author
Message
Mad Monkey
Mad Monkey
Forum God
Forum God (361 reputation)Forum God (361 reputation)Forum God (361 reputation)Forum God (361 reputation)Forum God (361 reputation)Forum God (361 reputation)Forum God (361 reputation)Forum God (361 reputation)Forum God (361 reputation)

Group: Forum Members
Posts: 1, Visits: 2

Hello All I have very simple question and Im making very simple game:

 

Say i have random number generator with Select Case in a loop

counter = 0

Do

number = Int(rnd * 20) + 1

Select case number

Case 1

.....

Case 2

...etc

counter = counter + 1

Loop While counter < 10

So I have the same case looping 10 times, but the thing I want is that when the case was selected for it never to be selected in the next loops? Is there any simple way to do that?    P.S Im realy new to vb6 so try not to confuse me


major
major
Forum God
Forum God (37K reputation)Forum God (37K reputation)Forum God (37K reputation)Forum God (37K reputation)Forum God (37K reputation)Forum God (37K reputation)Forum God (37K reputation)Forum God (37K reputation)Forum God (37K reputation)

Group: Forum Members
Posts: 367, Visits: 100
can u try and explain it a bit more, sorry, i dont quite understand. Alos upload ur code so that we can get a better understanding.



pso
pso
Forum God
Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)Forum God (73K reputation)

Group: Forum Members
Posts: 794, Visits: 338
Do you mean not to repeat the number that is generated?

Private Sub Command1_Click()
Dim counter As Integer, oldnum As Integer, number As Integer
Randomize
counter = 0
oldnum = 0
Do

number = Int(Rnd * 20) + 1
If oldnum = number Then GoTo nextNum
Select Case number

Case Else
Text2 = Text2 & number & vbCrLf
End Select
counter = counter + 1
oldnum = number
nextNum:
Loop While counter < 10
End Sub





Tongue

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search