Buongiorno,
sto girando attorno ai delegati senza sapere come risolvere il problema.
Ho questo frammento di codice che crea un delegato per scrivere in una richtextbox da un thread separato:
codice:
Namespace Delegates
Namespace RichTextBoxes
Public Module Container
Private Delegate Sub DELappendText(ByRef Frm As Form, ByRef Box As RichTextBox, ByRef Text As String)
Public Sub appendText(ByRef Frm As Form, ByRef Box As RichTextBox, ByRef Text As String)
If Frm Is Nothing Then Exit Sub
If Frm.IsDisposed Then Exit Sub
If Box Is Nothing Then Exit Sub
If Box.IsDisposed Then Exit Sub
If Frm.InvokeRequired Then
Dim DT As New DELappendText(AddressOf appendText)
Frm.Invoke(DT, New Object() {Frm, Box, Text})
Else
Box.Text &= Text
End If
End Sub
End Module
End Namespace
End Namespace
Come posso modificare questo codice in modo tale che invece di scrivere nella richtextbox vada a lavorare sul windowstate della form che lo contiene ?
Altra cosa, se nel form avessi 10 textbox per esempio, dovrei creare altrettanti delegate per poter scrivere dentro le 10 textbox ?
Grazie per l'aiuto, Alberto