none
PB DE CODE SUR EXEMPLE DE JEU DES COMBINAISONS RRS feed

  • Discussion générale

  • J"ai   pleins   de  pbs   sur    le   code   du   jeu   des   combinaisons   :    si   tu   as   un   code   corrigé   ,je    pense    que    cela    serait    plus    simples    pour    apprendre   

    COrdialement

    Public Class Form1

        ' Use this Random object to choose random icons for the squares
        Dim random As New Random

        ' Each of these letters is an interesting icon
        ' in the Webdings font,
        ' and each icon appears twice in this list
        Dim temporaryArray() As String = {"!", "!", "N", "N", ",", ",", "k", "k", _
                                          "b", "b", "v", "v", "w", "w", "z", "z"}
        Dim icons As List(Of String) = temporaryArray.ToList()
        ' List<string
    End Class

    Private Sub AssignIconsToSquares()

        ' The TableLayoutPanel has 16 labels,
        ' and the icon list has 16 icons,
        ' so an icon is pulled at random from the list
        ' and added to each label
        For Each control In TableLayoutPanel1.Controls
            Dim iconLabel As Label = TryCast(control, Label)
            If iconLabel IsNot Nothing Then
                Dim randomNumber As Integer = random.Next(icons.Count)
                iconLabel.Text = icons.ElementAt(randomNumber)
                ' iconLabel.ForeColor = iconLabel.BackColor
                icons.RemoveAt(randomNumber)
            End If
        Next

    End Sub
    For Each control In TableLayoutPanel1.Controls
    ' The statements you want to execute 
    ' for each label go here
    ' The statements use iconLabel to access 
    ' each label's properties and methods
    Next

    • Type modifié Aurel Bera lundi 1 octobre 2012 12:19 Pas de reponse
    vendredi 24 août 2012 15:05

Toutes les réponses