Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

RubenT

Programa Totoloto Vb

Recommended Posts

RubenT

Boa tarde estou tentando resolver um exercicio do totoloto mas estou com uns problemas e precisava de ajuda pff.

 

 

Exercicio o que tenho que fazer--

Em Apostar: o Permitir ao apostador fazer entre 1 a 10 apostas simples (1 boletim), guardar os números selecionados pelo apostador de acordo com o número de apostas indicadas;

o Selecionar um “número da sorte” por conjunto de apostas. o Calcular e mostrar o valor a pagar pela(s) aposta(s). 30 pontos 10 pontos 5 pontos

 

• Em Ver Apostas: o Permitir ver as apostas realizadas pelo apostador; o Os números devem aparecer em grelha de aposta. 10 pontos 20 pontos • Em Sortear: o Gerar automaticamente uma chave, não podendo existir valores repetidos; o A chave sorteada deve ser apresentada por ordem crescente. 30 pontos 10 pontos

 

• Em Verificar Apostas: o Comparar as apostas feitas com a chave sorteada e indicar o número de prémios (de acordo com um boletim oficial); o Indicar prémios por aposta.

 

 

 

Totoloto

-o utilizador tem de escolher quantas apostas quer fazer

- o utilizador tem que escolher 5 numeros e 2 estrelas

na parte do apostar.

 

Programa que me tou a inspirar, e queria tentar fazer como este abaixzo

Capturar7.PNG.6c985ef98fbe8886a851603c453e1d2b.PNGCapturar.PNG.170ffeb436483542b5eb77fd2171ada0.PNG

 

Meu programa:

A minha duvida é o utilizador tem que escolher quantas apostas quer fazer,como faço para ex:o utilizador quer fazer 5 apostas,como faço para o programa só deixar o utilizador fazer 5 apostas e como faco para que ele possa introduzir as 5 apostas,    e iria ficar muito grande o codigo se copiasse os botoes abaixo e duplicasse

 

 

atualizado.PNG.83c38ede185f525bdbffe72bbdc2957f.PNG

 

Todos os buttoes que estam acima tem este codigo abaixo

Capturar3.PNG.a3676be75d71a6ca4b26691ef318b31e.PNG

 

Codigo completo Vb

Public Class Form3
    
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Button2.BackColor = Color.Red
        Button2.Text = "1"

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Button3.BackColor = Color.Red
        Button3.Text = "2"
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Button4.BackColor = Color.Red
        Button4.Text = "3"
    End Sub

    Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub PictureBox1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Button5.BackColor = Color.Red
        Button5.Text = "4"
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        Button11.BackColor = Color.Red
        Button11.Text = "5"
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Button10.BackColor = Color.Red
        Button10.Text = "6"
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Button9.BackColor = Color.Red
        Button9.Text = "7"
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Button8.BackColor = Color.Red
        Button8.Text = "8"
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Button7.BackColor = Color.Red
        Button7.Text = "9"
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Button6.BackColor = Color.Red
        Button6.Text = "10"
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        Button13.BackColor = Color.Red
        Button13.Text = "11"
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        Button12.BackColor = Color.Red
        Button12.Text = "12"
    End Sub

    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
        Button19.BackColor = Color.Red
        Button19.Text = "13"
    End Sub

    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        Button18.BackColor = Color.Red
        Button18.Text = "14"
    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
        Button17.BackColor = Color.Red
        Button17.Text = "15"
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        Button16.BackColor = Color.Red
        Button16.Text = "16"
    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        Button15.BackColor = Color.Red
        Button15.Text = "17"
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        Button14.BackColor = Color.Red
        Button14.Text = "18"
    End Sub

    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click
        Button25.BackColor = Color.Red
        Button25.Text = "19"
    End Sub

    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click
        Button24.BackColor = Color.Red
        Button24.Text = "20"
    End Sub

    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click
        Button23.BackColor = Color.Red
        Button23.Text = "21"
    End Sub

    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click
        Button22.BackColor = Color.Red
        Button22.Text = "22"
    End Sub

    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
        Button21.BackColor = Color.Red
        Button21.Text = "23"
    End Sub

    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
        Button20.BackColor = Color.Red
        Button20.Text = "24"
    End Sub

    Private Sub Button31_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button31.Click
        Button31.BackColor = Color.Red
        Button31.Text = "25"
    End Sub

    Private Sub Button30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button30.Click
        Button30.BackColor = Color.Red
        Button30.Text = "26"
    End Sub

    Private Sub Button29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button29.Click
        Button29.BackColor = Color.Red
        Button29.Text = "27"
    End Sub

    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button28.Click
        Button28.BackColor = Color.Red
        Button28.Text = "28"
    End Sub

    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click
        Button27.BackColor = Color.Red
        Button27.Text = "29"
    End Sub

    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
        Button26.BackColor = Color.Red
        Button26.Text = "30"
    End Sub

    Private Sub Button37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button37.Click
        Button37.BackColor = Color.Red
        Button37.Text = "31"
    End Sub

    Private Sub Button36_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button36.Click
        Button36.BackColor = Color.Red
        Button36.Text = "32"
    End Sub

    Private Sub Button35_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button35.Click
        Button35.BackColor = Color.Red
        Button35.Text = "33"
    End Sub

    Private Sub Button34_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button34.Click
        Button34.BackColor = Color.Red
        Button34.Text = "34"
    End Sub

    Private Sub Button33_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button33.Click
        Button33.BackColor = Color.Red
        Button33.Text = "35"
    End Sub

    Private Sub Button32_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button32.Click
        Button32.BackColor = Color.Red
        Button32.Text = "36"
    End Sub

    Private Sub Button43_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button43.Click
        Button43.BackColor = Color.Red
        Button43.Text = "37"
    End Sub

    Private Sub Button42_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button42.Click
        Button42.BackColor = Color.Red
        Button42.Text = "38"
    End Sub

    Private Sub Button41_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button41.Click
        Button41.BackColor = Color.Red
        Button41.Text = "39"
    End Sub

    Private Sub Button40_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button40.Click
        Button40.BackColor = Color.Red
        Button40.Text = "40"
    End Sub

    Private Sub Button39_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button39.Click
        Button39.BackColor = Color.Red
        Button39.Text = "41"
    End Sub

    Private Sub Button38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button38.Click
        Button38.BackColor = Color.Red
        Button38.Text = "42"
    End Sub

    Private Sub Button49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button49.Click
        Button49.BackColor = Color.Red
        Button49.Text = "43"
    End Sub

    Private Sub Button48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button48.Click
        Button48.BackColor = Color.Red
        Button48.Text = "44"
    End Sub

    Private Sub Button47_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button47.Click
        Button47.BackColor = Color.Red
        Button47.Text = "45"
    End Sub

    Private Sub Button46_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button46.Click
        Button46.BackColor = Color.Red
        Button46.Text = "46"
    End Sub

    Private Sub Button45_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button45.Click
        Button45.BackColor = Color.Red
        Button45.Text = "47"
    End Sub

    Private Sub Button44_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button44.Click
        Button44.BackColor = Color.Red
        Button44.Text = "48"
    End Sub

    Private Sub Button55_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button55.Click
        Button55.BackColor = Color.Red
        Button55.Text = "19"
    End Sub

    
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

    End Sub




    Private Sub TextBox1_TextChanged_2(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim aposta, num As Integer




    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub



    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    'Estrelas buttoes


    Private Sub Button56_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button56.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "1"
    End Sub

    Private Sub Button54_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button54.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "2"
    End Sub

    Private Sub Button53_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button53.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "3"
    End Sub

    Private Sub Button52_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button52.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "4"
    End Sub

    Private Sub Button51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button51.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "5"
    End Sub

    Private Sub Button50_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button50.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "6"
    End Sub

    Private Sub Button63_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button63.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "7"
    End Sub

    Private Sub Button62_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button62.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "8"
    End Sub

    Private Sub Button61_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button61.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "9"
    End Sub

    Private Sub Button60_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button60.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "10"
    End Sub

    Private Sub Button59_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button59.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "11"
    End Sub

    Private Sub Button58_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button58.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "12"
    End Sub


    Private Sub Button57_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button57.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "13"
    End Sub
End Class

 

 

Edited by RubenT
Atulização

Share this post


Link to post
Share on other sites
M6

Perguntas ao utilizador quantas apostas ele quer fazer e depois colocas a rotina da aposta num ciclo de 1 até ao número de apostas que o utilizador disse que queria fazer.


10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Share this post


Link to post
Share on other sites
RubenT
3 horas atrás, M6 disse:

Perguntas ao utilizador quantas apostas ele quer fazer e depois colocas a rotina da aposta num ciclo de 1 até ao número de apostas que o utilizador disse que queria fazer.

mas o problema é que tenho muitos botões, e como faço para os repetir a todos, e ainda tenho que limitar os buttoes porque só posso escolher 5 numeros e uma estrela

Dei uma atualizada no programa para se perceber mais facil

 

 

atualizado.PNG.83c38ede185f525bdbffe72bbdc2957f.PNG

 

Codigo

 

Public Class Form3
    
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Button2.BackColor = Color.Red
        Button2.Text = "1"

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Button3.BackColor = Color.Red
        Button3.Text = "2"
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Button4.BackColor = Color.Red
        Button4.Text = "3"
    End Sub

    Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub PictureBox1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Button5.BackColor = Color.Red
        Button5.Text = "4"
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        Button11.BackColor = Color.Red
        Button11.Text = "5"
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Button10.BackColor = Color.Red
        Button10.Text = "6"
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Button9.BackColor = Color.Red
        Button9.Text = "7"
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Button8.BackColor = Color.Red
        Button8.Text = "8"
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Button7.BackColor = Color.Red
        Button7.Text = "9"
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Button6.BackColor = Color.Red
        Button6.Text = "10"
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        Button13.BackColor = Color.Red
        Button13.Text = "11"
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        Button12.BackColor = Color.Red
        Button12.Text = "12"
    End Sub

    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
        Button19.BackColor = Color.Red
        Button19.Text = "13"
    End Sub

    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        Button18.BackColor = Color.Red
        Button18.Text = "14"
    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
        Button17.BackColor = Color.Red
        Button17.Text = "15"
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        Button16.BackColor = Color.Red
        Button16.Text = "16"
    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        Button15.BackColor = Color.Red
        Button15.Text = "17"
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        Button14.BackColor = Color.Red
        Button14.Text = "18"
    End Sub

    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click
        Button25.BackColor = Color.Red
        Button25.Text = "19"
    End Sub

    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click
        Button24.BackColor = Color.Red
        Button24.Text = "20"
    End Sub

    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click
        Button23.BackColor = Color.Red
        Button23.Text = "21"
    End Sub

    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click
        Button22.BackColor = Color.Red
        Button22.Text = "22"
    End Sub

    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
        Button21.BackColor = Color.Red
        Button21.Text = "23"
    End Sub

    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
        Button20.BackColor = Color.Red
        Button20.Text = "24"
    End Sub

    Private Sub Button31_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button31.Click
        Button31.BackColor = Color.Red
        Button31.Text = "25"
    End Sub

    Private Sub Button30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button30.Click
        Button30.BackColor = Color.Red
        Button30.Text = "26"
    End Sub

    Private Sub Button29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button29.Click
        Button29.BackColor = Color.Red
        Button29.Text = "27"
    End Sub

    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button28.Click
        Button28.BackColor = Color.Red
        Button28.Text = "28"
    End Sub

    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click
        Button27.BackColor = Color.Red
        Button27.Text = "29"
    End Sub

    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
        Button26.BackColor = Color.Red
        Button26.Text = "30"
    End Sub

    Private Sub Button37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button37.Click
        Button37.BackColor = Color.Red
        Button37.Text = "31"
    End Sub

    Private Sub Button36_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button36.Click
        Button36.BackColor = Color.Red
        Button36.Text = "32"
    End Sub

    Private Sub Button35_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button35.Click
        Button35.BackColor = Color.Red
        Button35.Text = "33"
    End Sub

    Private Sub Button34_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button34.Click
        Button34.BackColor = Color.Red
        Button34.Text = "34"
    End Sub

    Private Sub Button33_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button33.Click
        Button33.BackColor = Color.Red
        Button33.Text = "35"
    End Sub

    Private Sub Button32_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button32.Click
        Button32.BackColor = Color.Red
        Button32.Text = "36"
    End Sub

    Private Sub Button43_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button43.Click
        Button43.BackColor = Color.Red
        Button43.Text = "37"
    End Sub

    Private Sub Button42_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button42.Click
        Button42.BackColor = Color.Red
        Button42.Text = "38"
    End Sub

    Private Sub Button41_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button41.Click
        Button41.BackColor = Color.Red
        Button41.Text = "39"
    End Sub

    Private Sub Button40_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button40.Click
        Button40.BackColor = Color.Red
        Button40.Text = "40"
    End Sub

    Private Sub Button39_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button39.Click
        Button39.BackColor = Color.Red
        Button39.Text = "41"
    End Sub

    Private Sub Button38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button38.Click
        Button38.BackColor = Color.Red
        Button38.Text = "42"
    End Sub

    Private Sub Button49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button49.Click
        Button49.BackColor = Color.Red
        Button49.Text = "43"
    End Sub

    Private Sub Button48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button48.Click
        Button48.BackColor = Color.Red
        Button48.Text = "44"
    End Sub

    Private Sub Button47_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button47.Click
        Button47.BackColor = Color.Red
        Button47.Text = "45"
    End Sub

    Private Sub Button46_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button46.Click
        Button46.BackColor = Color.Red
        Button46.Text = "46"
    End Sub

    Private Sub Button45_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button45.Click
        Button45.BackColor = Color.Red
        Button45.Text = "47"
    End Sub

    Private Sub Button44_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button44.Click
        Button44.BackColor = Color.Red
        Button44.Text = "48"
    End Sub

    Private Sub Button55_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button55.Click
        Button55.BackColor = Color.Red
        Button55.Text = "19"
    End Sub

    
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

    End Sub




    Private Sub TextBox1_TextChanged_2(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim aposta, num As Integer




    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub



    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    'Estrelas buttoes


    Private Sub Button56_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button56.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "1"
    End Sub

    Private Sub Button54_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button54.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "2"
    End Sub

    Private Sub Button53_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button53.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "3"
    End Sub

    Private Sub Button52_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button52.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "4"
    End Sub

    Private Sub Button51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button51.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "5"
    End Sub

    Private Sub Button50_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button50.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "6"
    End Sub

    Private Sub Button63_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button63.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "7"
    End Sub

    Private Sub Button62_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button62.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "8"
    End Sub

    Private Sub Button61_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button61.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "9"
    End Sub

    Private Sub Button60_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button60.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "10"
    End Sub

    Private Sub Button59_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button59.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "11"
    End Sub

    Private Sub Button58_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button58.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "12"
    End Sub


    Private Sub Button57_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button57.Click
        Button55.BackColor = Color.Yellow
        Button55.Text = "13"
    End Sub
End Class

 

 

Eu queria fazer como este so que o problema é que ia tar a criar muitos buttoes  e o codigo iria ficar muito confuso e cheio 

Capturar7.PNG.6c985ef98fbe8886a851603c453e1d2b.PNG

Edited by RubenT
Erro

Share this post


Link to post
Share on other sites
M6

Divide a aplicação em duas janelas, a primeira tem só o número de apostas e a segunda as apostas em si, só passas da primeira para a segunda quando o utilizador diz quantas apostas quer fazer.

Depois tens o ciclo a funcionar pelo número de apostas, tal como referi.

 


10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Share this post


Link to post
Share on other sites
RubenT
51 minutos atrás, M6 disse:

Divide a aplicação em duas janelas, a primeira tem só o número de apostas e a segunda as apostas em si, só passas da primeira para a segunda quando o utilizador diz quantas apostas quer fazer.

Depois tens o ciclo a funcionar pelo número de apostas, tal como referi.

 

Tenho mais uma duvida como faço para limitar o utilizador só a selecionar 5 buttoes que no caso sao os numeros e tambem limitar as estrelas que o utilizador só pode selecionar 2 buttoes

Share this post


Link to post
Share on other sites
M6

Usas um contador que começa em 5 e vais tirando 1 cada vez que o utilizador seleciona um número. Quando chegar a 0 impedes que o utilizador escolha mais números.

As estrelas é a mesma estratégia.


10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Share this post


Link to post
Share on other sites
RubenT
18 horas atrás, M6 disse:

Usas um contador que começa em 5 e vais tirando 1 cada vez que o utilizador seleciona um número. Quando chegar a 0 impedes que o utilizador escolha mais números.

As estrelas é a mesma estratégia.

Mas tenho que colocar todos os buttoes dentro desse contador?, o programa tem que ver quais botoes foram selecionados?

Edited by RubenT
completar

Share this post


Link to post
Share on other sites
M6

Obviamente o programa tem se saber quais os botões que foram selecionados.

Deves ter uma lista para guardar as apostas que o utilizador faz e, dentro de cada aposta (posição nessa lista) podes guardar os números selecionados num array.
Cada vez que o utilizador escolhe um botão, adicionas esse número ao array.


10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.