Bonjour/Bonsoir,

Voila, depuis ce matin, j'ai dans l'idée de me faire un chrono, pour tester mes performances au Rubik's Cube .


Donc,j'ai réussi a faire, un bouton pour lancer le chrono, un autre pour l’arrêter et enfin un dernier pour remettre a ZérO.
Un label avec le temps, mais je n'arrive pas, à: Générer une chaîne de 20 caractères.
J'ai déjà la fonction pour la chaîne, mais, je n'arrive pas a la faire apparaître en MsgBox,

Voila mon code:


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 
Public Class FormMain
    Dim ChronoStarted As Boolean = False
    Dim temps2 As Date
    Dim TempsDepart As New Date
    Dim TempsFin As New Date
 
 
    Function CreateAleatoire(ByVal StrTaille)
 
        Dim l, s, i, Dictionnaire
        If StrTaille = 20 Then
 
        End If
        Exit Function
 
        Dictionnaire = "F F' F2 B B' B2 L L' L2 R R' R2 U U' U2 D D' D2"
 
        l = len(Dictionnaire)
        For i = 0 To StrTaille - 1
            randomize()
            s = s & mid(Dictionnaire, int(rnd * l) + 1, 1)
        Next
        CreateAleatoire = s
 
    End Function
 
    Private Sub FormMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ChronoStarted = False
        TimerChrono.Enabled = True
        TimerChrono.Interval = 1
        LabelCompteur.Text = "00:00:00:0000000"
        TempsDepart = Now
        TempsFin = Now
        ButtonReset.Enabled = False
 
 
    End Sub
    Private Sub ButtonStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStart.Click
        If ChronoStarted Then
            ChronoStarted = False
            ButtonStart.Text = "Start"
            ButtonReset.Enabled = True
        Else
            ChronoStarted = True
            ButtonStart.Text = "Stop"
            TempsDepart = Now
            ButtonReset.Enabled = False
        End If
 
    End Sub
    Private Sub TimerChrono_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerChrono.Tick
        If ChronoStarted Then
            TempsFin = Now
            LabelCompteur.Text = (TempsFin - TempsDepart).ToString
            LabelCompteur.Refresh()
        End If
    End Sub
    Private Sub ButtonReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonReset.Click
        LabelCompteur.Text = "00:00:00:0000000"
 
    End Sub
 
End Class