Salut,
j'ai deux techniques qui fonctionnent, laquelle est la meilleure ?
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 Public Delegate Sub SetTextBoxDelegate(ByVal TB As TextBox, ByVal txt As String) Public Sub Textbox_safe(ByVal TB As TextBox, ByVal txt As String) If TB.InvokeRequired Then TB.Invoke(New SetTextBoxDelegate(AddressOf Textbox_safe), New Object() {TB, txt}) Else TB.Text = txt End If End Sub Public Sub Texte_safe(box As TextBox, text As String) If box.InvokeRequired Then box.Invoke(Sub() box.Text = text) Else box.Text = text End If End Sub
Partager