Bonjour,
J'ai besoin d'afficher des controles pendants un traitement lord .
j'ai réaliser un petit exemple ,pendant que la boucle infini tourne je veux afficher un bouton




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
Imports System.Drawing
Imports System.Threading
Imports System.Windows.Forms
Public Class Form1
 
    Private t As Thread
    Private t1 As Thread
    Private Delegate Sub ChangeLabel(ByVal str As String)
    Private Delegate Sub boucle()
 
    Private Sub ThreadMethod()
        Me.Invoke(New ChangeLabel(AddressOf ChangeLabelText), "Label après opération")
 
    End Sub
    Private Sub ChangeLabelText(ByVal str As String)
        labelTest.Text = str
        ProgressBar1.Visible = True
        Button2.Visible = True
        Thread.Sleep(2000)
    End Sub
    Private Sub ThreadMethod2()
        Me.Invoke(New boucle(AddressOf loopp))
 
    End Sub
    Private Sub loopp()
        Dim i As Int16 = 0
        While i < 10666
            ListBox1.Items.Add(i)
            ' i += 1
        End While
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        t = New Thread(New ThreadStart(AddressOf ThreadMethod))
        t.Start()
 
        t1 = New Thread(New ThreadStart(AddressOf ThreadMethod2))
        t1.Start()
 
    End Sub
 
 
End Class
Merci pour votre aide