M
M O J O
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.Threading
Public Class MyThreadClass
Private _thread As Thread
Public Delegate Sub ThreadDone(ByVal IsOnline As Boolean)
Public OnThreadDone As ThreadDone
Public Sub Run()
_thread = New Thread(AddressOf Start)
_thread.IsBackground = 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(1000)
OnThreadDone.Invoke(True)
Catch
OnThreadDone.Invoke(False)
Finally
End Try
End Sub
End Class
---------------------------------------------------------------------------
And here's my form code:
Private _thread As MyThreadClass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
_thread = New MyThreadClass
_thread.OnThreadDone = AddressOf OnThreadDone
_thread.Run()
End Sub
Public Sub OnThreadDone(ByVal status As Boolean)
Me.Button1.Visible = True
' The button is still hidden (((
End Sub
---------------------------------------------------------------------------
What am I doing wrong??
Why doesn't the button show up?
Thanks in advance!!
M O J O
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.Threading
Public Class MyThreadClass
Private _thread As Thread
Public Delegate Sub ThreadDone(ByVal IsOnline As Boolean)
Public OnThreadDone As ThreadDone
Public Sub Run()
_thread = New Thread(AddressOf Start)
_thread.IsBackground = 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(1000)
OnThreadDone.Invoke(True)
Catch
OnThreadDone.Invoke(False)
Finally
End Try
End Sub
End Class
---------------------------------------------------------------------------
And here's my form code:
Private _thread As MyThreadClass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
_thread = New MyThreadClass
_thread.OnThreadDone = AddressOf OnThreadDone
_thread.Run()
End Sub
Public Sub OnThreadDone(ByVal status As Boolean)
Me.Button1.Visible = True
' The button is still hidden (((
End Sub
---------------------------------------------------------------------------
What am I doing wrong??
Why doesn't the button show up?
Thanks in advance!!
M O J O