1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Sub AttribueNombre()
Dim UnNombre As Integer
Dim k As Integer = 1 ' numéro des PictureBox
For i As Integer = 1 To 1000
UnNombre = hasard(2, 11)
If dicoNb(UnNombre) < 21 Then ' chaque nombre peut être attribué 21 fois
DirectCast(Me.Controls("Picturebox" & k.ToString), PictureBox).Tag = UnNombre
DirectCast(Me.Controls("label" & k.ToString), Label).Text = UnNombre ' voir le nombre
k += 1
End If
dicoNb(UnNombre) += 1
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AttribueNombre()
End Sub |
Partager