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
|
Public Class Form2
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer2.Interval = 10000
Timer2.Start()
Timer1.Interval = 500
Timer1.Start()
End Sub
Private Delegate Function DlgMaFonction()
Private Function MaFonction()
If Me.InvokeRequired Then
Return Me.Invoke(New DlgMaFonction(AddressOf MaFonction))
End If
' Le code de ma fonction
Fonction1()
End Function
Sub Fonction1()
For i As Integer = 0 To 100000
'Application.DoEvents()
Label1.Text = "fonction 1 :" & i
Next
End Sub
Private Sub BGW2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgwDesign.DoWork
MaFonction()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
bgwDesign.RunWorkerAsync()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label2.Text = Date.Now.Second
End Sub
End Class |
Partager