none
jogo de sorteio.

    Question

  • Public Class Form1
        Dim numeros(5) As Integer
        Dim a, b, c, d, f, g, contador As Integer
    
    
        Private Sub btnjogar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnjogar.Click
            tmrSorteio.Enabled = True
            If a = b Or b = c Or c = d Or f = g Or a = c Or a = d Or a = f Or a = g Or b = d Or b = f Or b = g Or c = f Or c - g Or d = g Or f = g Or c = f Then
                tmrSorteio.Enabled = True
    
            End If
            btnjogar.Enabled = False
    
            
    
    
        End Sub
    
        Private Sub tmrSorteio_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrSorteio.Tick
            Randomize()
            contador += 1
            a = Int(70 * Rnd() + 1)
            txt1.Text = (a)
            b = Int(70 * Rnd() + 1)
            txt2.Text = (b)
            c = Int(70 * Rnd() + 1)
            txt3.Text = (c)
            d = Int(70 * Rnd() + 1)
            txt4.Text = (d)
            f = Int(70 * Rnd() + 1)
            txt5.Text = (f)
            g = Int(70 * Rnd() + 1)
            txt6.Text = (g)
           
    
    
            
    
    
            numeros(0) = a
            numeros(1) = b
            numeros(2) = c
            numeros(3) = d
            numeros(4) = f
            numeros(5) = g
    
    
            If contador = 10 Then
                tmrSorteio.Enabled = False
                contador = 0
                For i As Integer = 0 To 5
                    ListBox1.Items.Add(numeros(i))
    
                Next
    
                contador += 1
                For i As Integer = 0 To 5
                    For Me.d = 0 To 5
    
                        If ListBox1.Items(i) = ListBox2.Items(d) Then
    
    
    
                            ListBox3.Items.Add("voce acertou com o " & ListBox2.Items(d))
    
    
    
    
                            
    
    
                        End If
    
                    Next
                Next
    
    
            End If
        End Sub
    
       
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            
        End Sub
    
        Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
            
            ListBox2.Items.Add(1)
            btn1.Enabled = False
    
    
    
    
    
    
        End Sub
    
        Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
    
            ListBox2.Items.Add(2)
            btn2.Enabled = False
    
    
        End Sub
    
        Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
    
            ListBox2.Items.Add(3)
            btn3.Enabled = False
    
        End Sub
    
        Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
    
            ListBox2.Items.Add(4)
            btn4.Enabled = False
    
        End Sub
    
        Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
    
    
            ListBox2.Items.Add(5)
            btn5.Enabled = False
    
        End Sub
    
        Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
    
    
            ListBox2.Items.Add(6)
            btn6.Enabled = False
    
        End Sub
    
        Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
            ListBox2.Items.Add(7)
            btn7.Enabled = False
    
        End Sub
    
        Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
    
            ListBox2.Items.Add(8)
            btn8.Enabled = False
    
    
    
        End Sub
    
        Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
    
            ListBox2.Items.Add(9)
            btn9.Enabled = False
    
        End Sub
    
        Private Sub btn10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn10.Click
    
            ListBox2.Items.Add(10)
            btn10.Enabled = False
    
        End Sub
    
        Private Sub btn11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn11.Click
    
            ListBox2.Items.Add(11)
            btn11.Enabled = False
    
        End Sub
    
        Private Sub btn12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn12.Click
    
            ListBox2.Items.Add(12)
            btn12.Enabled = False
    
        End Sub
    
        Private Sub btn13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn13.Click
    
            ListBox2.Items.Add(13)
            btn13.Enabled = False
    
        End Sub
    
        Private Sub btn14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn14.Click
    
            ListBox2.Items.Add(14)
            btn14.Enabled = False
    
        End Sub
    
        Private Sub btn15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn15.Click
    
            ListBox2.Items.Add(15)
            btn15.Enabled = False
    
        End Sub
    
        Private Sub btn16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn16.Click
    
            ListBox2.Items.Add(16)
            btn16.Enabled = False
    
        End Sub
    
        Private Sub btn17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn17.Click
    
            ListBox2.Items.Add(17)
            btn17.Enabled = False
    
        End Sub
    
        Private Sub btn18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn18.Click
    
            ListBox2.Items.Add(18)
            btn18.Enabled = False
    
        End Sub
    
        Private Sub btn19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn19.Click
    
            ListBox2.Items.Add(19)
            btn19.Enabled = False
    
        End Sub
    
        Private Sub btn20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn20.Click
    
            ListBox2.Items.Add(20)
            btn20.Enabled = False
    
        End Sub
    
        Private Sub btn21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn21.Click
    
            ListBox2.Items.Add(21)
            btn21.Enabled = False
    
        End Sub
    
        Private Sub btn22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn22.Click
    
            ListBox2.Items.Add(22)
            btn22.Enabled = False
    
        End Sub
    
        Private Sub btn23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn23.Click
    
            ListBox2.Items.Add(23)
            btn23.Enabled = False
    
        End Sub
    
        Private Sub btn24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn24.Click
    
            ListBox2.Items.Add(24)
            btn24.Enabled = False
    
        End Sub
    
        Private Sub btn25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn25.Click
    
            ListBox2.Items.Add(25)
            btn25.Enabled = False
    
        End Sub
    
        Private Sub btn26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn26.Click
    
            ListBox2.Items.Add(26)
            btn26.Enabled = False
    
        End Sub
    
        Private Sub btn27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn27.Click
    
            ListBox2.Items.Add(27)
            btn27.Enabled = False
    
        End Sub
    
        Private Sub btn28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn28.Click
    
            ListBox2.Items.Add(28)
            btn28.Enabled = False
    
        End Sub
    
        Private Sub btn29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn29.Click
    
            ListBox2.Items.Add(29)
            btn29.Enabled = False
    
        End Sub
    
        Private Sub btn30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn30.Click
    
            ListBox2.Items.Add(30)
            btn30.Enabled = False
    
        End Sub
    
        Private Sub btn31_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn31.Click
    
            ListBox2.Items.Add(31)
            btn31.Enabled = False
    
        End Sub
    
        Private Sub btn32_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn32.Click
    
            ListBox2.Items.Add(32)
            btn32.Enabled = False
    
        End Sub
    
        Private Sub btn33_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn33.Click
    
            ListBox2.Items.Add(33)
            btn33.Enabled = False
    
        End Sub
    
        Private Sub btn34_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn34.Click
    
            ListBox2.Items.Add(34)
            btn34.Enabled = False
    
        End Sub
    
        Private Sub btn35_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn35.Click
    
            ListBox2.Items.Add(35)
            btn35.Enabled = False
    
        End Sub
    
        Private Sub btn36_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn36.Click
    
            ListBox2.Items.Add(36)
            btn36.Enabled = False
    
        End Sub
    
        Private Sub btn37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn37.Click
    
            ListBox2.Items.Add(37)
            btn37.Enabled = False
    
        End Sub
    
        Private Sub btn38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn38.Click
    
            ListBox2.Items.Add(38)
            btn38.Enabled = False
    
        End Sub
    
        Private Sub btn39_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn39.Click
    
            ListBox2.Items.Add(39)
            btn39.Enabled = False
    
        End Sub
    
        Private Sub btn40_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn40.Click
    
            ListBox2.Items.Add(40)
            btn40.Enabled = False
    
        End Sub
    
        Private Sub btn41_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn41.Click
    
            ListBox2.Items.Add(41)
            btn41.Enabled = False
    
        End Sub
    
        Private Sub btn42_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn42.Click
    
            ListBox2.Items.Add(42)
            btn42.Enabled = False
    
        End Sub
    
        Private Sub btn43_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn43.Click
    
            ListBox2.Items.Add(43)
            btn43.Enabled = False
    
        End Sub
    
        Private Sub btn44_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn44.Click
    
            ListBox2.Items.Add(44)
            btn44.Enabled = False
    
        End Sub
    
        Private Sub btn45_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn45.Click
    
            ListBox2.Items.Add(45)
            btn45.Enabled = False
    
        End Sub
    
        Private Sub btn46_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn46.Click
    
            ListBox2.Items.Add(46)
            btn46.Enabled = False
    
        End Sub
    
        Private Sub btn47_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn47.Click
    
            ListBox2.Items.Add(47)
            btn47.Enabled = False
    
        End Sub
    
        Private Sub btn48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn48.Click
    
            ListBox2.Items.Add(48)
            btn48.Enabled = False
    
        End Sub
    
        Private Sub btn49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn49.Click
    
            ListBox2.Items.Add(49)
            btn49.Enabled = False
    
        End Sub
    
        Private Sub btn50_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn50.Click
    
            ListBox2.Items.Add(50)
            btn50.Enabled = False
    
        End Sub
    
        Private Sub btn51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn51.Click
    
            ListBox2.Items.Add(51)
            btn51.Enabled = False
    
        End Sub
    
        Private Sub btn52_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn52.Click
    
            ListBox2.Items.Add(52)
            btn52.Enabled = False
    
        End Sub
    
        Private Sub btn53_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn53.Click
    
            ListBox2.Items.Add(53)
            btn53.Enabled = False
    
        End Sub
    
        Private Sub btn54_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn54.Click
    
            ListBox2.Items.Add(54)
            btn54.Enabled = False
    
        End Sub
    
        Private Sub btn55_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn55.Click
    
            ListBox2.Items.Add(55)
            btn55.Enabled = False
    
        End Sub
    
        Private Sub btn56_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn56.Click
    
            ListBox2.Items.Add(56)
            btn56.Enabled = False
    
        End Sub
    
        Private Sub btn57_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn57.Click
    
            ListBox2.Items.Add(57)
            btn57.Enabled = False
    
        End Sub
    
        Private Sub btn58_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn58.Click
    
            ListBox2.Items.Add(58)
            btn58.Enabled = False
    
        End Sub
    
        Private Sub btn59_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn59.Click
    
            ListBox2.Items.Add(59)
            btn59.Enabled = False
    
        End Sub
    
        Private Sub btn60_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn60.Click
    
            ListBox2.Items.Add(60)
            btn60.Enabled = False
    
        End Sub
    
        Private Sub btn61_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn61.Click
    
            ListBox2.Items.Add(61)
            btn61.Enabled = False
    
        End Sub
    
        Private Sub btn62_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn62.Click
    
            ListBox2.Items.Add(62)
            btn62.Enabled = False
    
        End Sub
    
        Private Sub btn63_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn63.Click
    
            ListBox2.Items.Add(63)
            btn63.Enabled = False
    
        End Sub
    
        Private Sub btn64_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn64.Click
    
            ListBox2.Items.Add(64)
            btn64.Enabled = False
    
        End Sub
    
        Private Sub btn65_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn65.Click
    
    
            ListBox2.Items.Add(65)
            btn65.Enabled = False
    
        End Sub
    
        Private Sub btn66_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn66.Click
    
            ListBox2.Items.Add(66)
            btn66.Enabled = False
    
        End Sub
    
        Private Sub btn67_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn67.Click
    
            ListBox2.Items.Add(67)
            btn67.Enabled = False
    
        End Sub
    
        Private Sub btn68_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn68.Click
    
            ListBox2.Items.Add(68)
            btn68.Enabled = False
    
        End Sub
    
        Private Sub btn69_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn69.Click
    
            ListBox2.Items.Add(69)
            btn69.Enabled = False
    
        End Sub
    
        Private Sub btn70_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn70.Click
    
            ListBox2.Items.Add(70)
            btn70.Enabled = False
    
        End Sub
    
        Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
    
    
        End Sub
    End Class
    

    Sunday, September 30, 2012 4:27 PM

All replies

  • esse projeto é jogo em vb que o usuario escolhe sei numero e depois aperta o botao jogar.Dai faz o sorteio .esse sistema tem 70 botoes de 1 a 70.qual a logica uasada para que quando eu tiver clickado em seis botoes ele ele disabilitem os outros botoes,pois´só pode apostar em 6 numeros?

    e depois comparar os numeros sorteados que estao no listbox1 com listbox3,se os seis numeros sorteios forem iguias os apostados trazer uma mensagem "PARABENS!!!VOCÊ É O NOVO GANHAR "

    Obs.:Esse jogo é como se fosse o jogo da mega sena

    E tambem nao pode sortear dois numeros iguais dai eu usei esse codigo

     Private Sub btnjogar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnjogar.Click
            tmrSorteio.Enabled = True
            If a = b Or b = c Or c = d Or f = g Or a = c Or a = d Or a = f Or a = g Or b = d Or b = f Or b = g Or c = f Or c - g Or d = g Or f = g Or c = f Then
                tmrSorteio.Enabled = True
    
            End If
            btnjogar.Enabled = False
    
            
    
    
        End Sub

    Sunday, September 30, 2012 5:34 PM
  • esse jogo é como se fosse o jogo da mega sena .

    Eu queria saber como eu faço a comparação do listbox1 com o listbox3 para que se tiver os "6" numeros apostados iguais trazer na tela "Voce é o novo ganhador"

    nesse jogo tem 70 botoes onde o jogar tem que escolher apenas 6 numeros.Como eu faço para que quando escolher os seis numeros deslabilitar todos o botoes,para que ele não possa escolher outro numero ?

    E depois eu queria o meu jogo tivesse um botao com o nome novo jogo ele exclui todos numeros  dos listbox com apenas um click ,para iniciar um novo jogo?

    E nesse jogo não pode ser sorteado dois numeros iguais ,como resolver isso?

     Private Sub btnjogar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnjogar.Click
            tmrSorteio.Enabled = True
            If a = b Or b = c Or c = d Or f = g Or a = c Or a = d Or a = f Or a = g Or b = d Or b = f Or b = g Or c = f Or c - g Or d = g Or f = g Or c = f Then
                tmrSorteio.Enabled = True
    
            End If
            btnjogar.Enabled = False
    
            
    
    
        End Sub

    eu usei esse codigo mas nao esta funcionado.

    Fico no aguardo Obrigado

    Sunday, September 30, 2012 6:19 PM
  • Campeão, este fórum é destinado a C#, e não vb.net. Segue fórum onde pode te ajudar mais:

    http://social.msdn.microsoft.com/Forums/pt-BR/vsvbasicpt/threads

    Abraço, boa sorte.

    Monday, October 01, 2012 12:38 PM