Tobyjug2222 0 Newbie Poster

Hi, this is regarding a program I was working on, and codeorder managed to help me out, big time!

Although One problem remains, I don't know how to make the streaks not duplicate. (If you don't understand, please review : http://bit.ly/Av6Xeb )

Private rnd As New Random '// DECLARED ONCE AND USES THE FUNCTION.

    Private Function getCoolRandomNumber(ByVal minCoolNumberValue As Integer, ByVal maxCoolNumberValue As Integer) As Integer
        rnd = New Random
        Return rnd.Next(minCoolNumberValue, maxCoolNumberValue)
    End Function
#Region "-----===-----===-----===-----===-----=== KILL STREAKS ===-----===-----===-----===-----===-----"
    Private Sub KillStreaks()
        '// send a random# to set the selected KillStreak.
        setKillStreaks(getCoolRandomNumber(1, 9), 1)
        setKillStreaks(getCoolRandomNumber(1, 9), 2)
        setKillStreaks(getCoolRandomNumber(1, 9), 3)
    End Sub

    Private Sub setKillStreaks(ByVal selRandomNumber As Integer, ByVal selKillStreak As Integer)
        Select Case selRandomNumber
            Case 1
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "SPY PLANE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "RC-XD")
                End Select
            Case 2
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "COUNTER-SPY PLANE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "SAM TURRET")
                End Select
            Case 3
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "CARE PACKAGE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "NAPALM STRIKE")
                End Select
            Case 4
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "SENTRY GUN")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "MORTAR TEAM")
                End Select
            Case 5
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "ATTACK HELICOPTER")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "VALKYRIE ROCKETS")
                End Select
            Case 6
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "BLACKBIRD")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "ROLLING THUNDER")
                End Select
            Case 7
                setKillStreakLabelText(selKillStreak, "CHOPPER GUNNER")
            Case 8
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "ATTACK DOGS")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "GUNSHIP")
                End Select
        End Select
        '// To Not duplicate, check if duplicate values and if found, call the Sub again for that selectedKillStreak.
        If lblKillStreak1.Text = lblKillStreak2.Text Or lblKillStreak1.Text = lblKillStreak3.Text Then setKillStreaks(getCoolRandomNumber(1, 9), 1)
        If lblKillStreak2.Text = lblKillStreak1.Text Or lblKillStreak2.Text = lblKillStreak3.Text Then setKillStreaks(getCoolRandomNumber(1, 9), 2)
    End Sub

    Private Sub setKillStreakLabelText(ByVal selKillStreak As Integer, ByVal selCoolTextForLabel As String) '// easier to manage.
        If selKillStreak = 1 Then lblKillStreak1.Text = selCoolTextForLabel
        If selKillStreak = 2 Then lblKillStreak2.Text = selCoolTextForLabel
        If selKillStreak = 3 Then lblKillStreak3.Text = selCoolTextForLabel
    End Sub
#End Region

Thanks, Toby!