Hi,
I have a little test project. I spin up a thread, lets it sleep for a
second and then the thread makes a button visible ... or at least should
make it visible, which it doesn't do.
---------------------------------------------------------------------------
Here's my thread class:
Imports System.Threadin g
Public Class MyThreadClass
Private _thread As Thread
Public Delegate Sub ThreadDone(ByVa l IsOnline As Boolean)
Public OnThreadDone As ThreadDone
Public Sub Run()
_thread = New Thread(AddressO f Start)
_thread.IsBackg round = True
_thread.Start()
End Sub
Public Sub SpinDown()
If _thread Is Nothing Then Exit Sub
_thread.Abort()
_thread = Nothing
End Sub
Public Sub Abort()
If _thread Is Nothing Then Exit Sub
_thread.Abort()
_thread = Nothing
End Sub
Private Sub Start()
Try
_thread.Sleep(1 000)
OnThreadDone.In voke(True)
Catch
OnThreadDone.In voke(False)
Finally
End Try
End Sub
End Class
---------------------------------------------------------------------------
And here's my form code:
Private _thread As MyThreadClass
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As _
System.EventArg s) Handles MyBase.Load
_thread = New MyThreadClass
_thread.OnThrea dDone = AddressOf OnThreadDone
_thread.Run()
End Sub
Public Sub OnThreadDone(By Val status As Boolean)
Me.Button1.Visi ble = True
' The button is still hidden :o(((
End Sub
---------------------------------------------------------------------------
What am I doing wrong??
Why doesn't the button show up?
Thanks in advance!!
M O J O