Jeg har kigget lidt på
http://www.code-magazine.com/Article.aspx?quickid=0211141 og prøvet mig frem..
Det gav følgende:
Public Class Form1
Dim f2 As New Form2
Delegate Sub delegateOpdater(ByVal Text As String)
Private mellemmand As delegateOpdater
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dim f2 As New Form2
f2.Show()
Dim t As System.Threading.Thread
t = New System.Threading.Thread(AddressOf Me.doit)
t.IsBackground = True
Me.mellemmand = New delegateOpdater(AddressOf Me.opdater)
t.Start()
End Sub
Private Sub opdater(ByVal tekst As String)
If TextBox1.InvokeRequired Then
TextBox1.Invoke(New delegateOpdater(AddressOf opdater), tekst)
Else
TextBox1.Text = tekst
End If
End Sub
Private Sub doit()
While (Not f2.IsDisposed())
End While
Me.mellemmand("1")
End Sub
End Class