Private Sub frmLoad_Load(sender As Object, e As EventArgs) Handles Me.Load ... pgbLoadProgress.Maximum = 35 : pgbLoadProgress.Value = 0 Dim tThread As New Thread(Sub() LoadTest() End Sub) tThread.IsBackground = True tThread.Start() End Sub Private Sub LoadTest() Dim AppPath As String = Mid(IO.Path.GetFullPath(Application.ExecutablePath), 1, Len(IO.Path.GetFullPath(Application.ExecutablePath)) - Len(IO.Path.GetFileName(Application.ExecutablePath))) Test_...(AppPath) Test_...() BeginInvoke(New MyDelegate_LoadDVD(AddressOf LoadDVD)) End Sub Private Delegate Sub MyDelegate_LoadDVD() Private Sub LoadDVD() Me.Hide() : frmDVD.Show() End Sub Private Sub Test_...(ByVal AppPath As String) BeginInvoke(New MyDelegate_UpdateLabelTestFile(AddressOf UpdateLabelTestFile), "DVDKit.dll") ... BeginInvoke(New MyDelegate_UpdateLoadProgress(AddressOf UpdateLoadProgress)) End Sub Private Delegate Sub MyDelegate_UpdateLabelTestFile(ByVal sText As String) Private Sub UpdateLabelTestFile(ByVal sText As String) lbTestFile.Text = sText End Sub Private Delegate Sub MyDelegate_UpdateLoadProgress() Private Sub UpdateLoadProgress() pgbLoadProgress.Value += 1 End Sub Private Sub Test_...() BeginInvoke(New MyDelegate_UpdateLabelTestFile(AddressOf UpdateLabelTestFile), "Sun JavaVM") ... BeginInvoke(New MyDelegate_UpdateLoadProgress(AddressOf UpdateLoadProgress)) End Sub
Private Sub Command1_Click()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Static toto, tata, i As Integer, combien As Integer
toto = Array("Label1", "Label2", "Label3") ' tes labels
tata = Array(10, 7, 9) ' la durée pour chacun d'entre eux
combien = combien + 1
Controls(toto(i)).Caption = combien
If combien = tata(i) Then
i = i + 1
combien = 0
End If
If i > UBound(toto) Then Timer1.Enabled = False
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate toto, tata
Private Sub Command1_Click()
Timer1.Interval = 1000
Timer1.Enabled = True
toto = Array(Label1, Label2, Label3)
tata = Array(12, 21, 18)
For i = 0 To UBound(toto)
toto(i).Caption = ""
toto(i).BackColor = vbWhite
toto(i).ForeColor = vbBlack
Next
End Sub
Private Sub Timer1_Timer()
Static i As Integer, combien As Integer
ProgressBar1.Min = 0
ProgressBar1.Max = tata(i)
combien = combien + 1
ProgressBar1.Value = combien
toto(i).Caption = combien
If combien = tata(i) Then
toto(i).Caption = combien
toto(i).BackColor = vbRed
toto(i).ForeColor = vbWhite
i = i + 1
combien = 0
End If
If i > UBound(toto) Then Timer1.Enabled = False
End Sub