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
| Private Delegate Sub SetTextBoxDelegate(Box As System.Windows.Forms.TextBox, Txt As String)
Public Sub TextBox_safe(Box As System.Windows.Forms.TextBox, Txt As String)
If Box.InvokeRequired Then
Box.Invoke(New SetTextBoxDelegate(AddressOf TextBox_safe), New Object() {Box, Txt})
Else
Box.Text = Txt
End If
End Sub
Private Delegate Sub SetLabelBoxDelegate(Box As System.Windows.Forms.Label, Txt As String)
Public Sub LabelBox_safe(Box As System.Windows.Forms.Label, Txt As String)
If Box.InvokeRequired Then
Box.Invoke(New SetLabelBoxDelegate(AddressOf LabelBox_safe), New Object() {Box, Txt})
Else
Box.Text = Txt
End If
End Sub
Private Delegate Sub SetRichTextBoxDelegate(Box As System.Windows.Forms.RichTextBox, Txt As String)
Public Sub RichTextBox_safe(Box As System.Windows.Forms.RichTextBox, Txt As String)
If Box.InvokeRequired Then
Box.Invoke(New SetRichTextBoxDelegate(AddressOf RichTextBox_safe), New Object() {Box, Txt})
Else
Box.Text = Txt
End If
End Sub
Public Sub RichTextBox_safe_refresh(Box As RichTextBox)
If Box.InvokeRequired Then
Box.Invoke(New SetRichTextBoxDelegate(AddressOf RichTextBox_safe), New Object() {Box})
Else
' Box.Refresh()
Box.Update()
End If
End Sub |
Partager