By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,552 Members | 905 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,552 IT Pros & Developers. It's quick & easy.

Thread just wont start!!?!?!

P: n/a
Hi there,

This one is really doing my head in, I am attempting to start a thread
using the following code,

--------------------

Public Sub start()
cTrdImportThread = New Threading.Thread(AddressOf
cTrdImportThread_Callback)
With cTrdImportThread
.Name = Tiger_AssemblyInfo.assemblyRootNamespace &
".PowerPointImporter"
.IsBackground = False
End With
Try
Call cTrdImportThread.Start()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
MessageBox.Show("Thread started!, state = " &
cTrdImportThread.ThreadState.ToString & ".")
End Sub

Private Sub cTrdImportThread_Callback()
MessageBox.Show("Hello??")
End Sub

--------------------

Even though no exception is raised when calling "Start" the thread never
starts, the message box at the end of the start routine states that the
thread is unstarted. It's as if the object does nothing what so ever. Any
ideas on why this is happening?? It has only started happening recently but
I'm unsure as to why.

Thanks loads for your help in advance!!

--
Nick Pateman

---------------------------------------------------------------
Any views expressed above are my own
Without predjudice
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Nick,

We have a long time not seen, I see this when there are licence problems,
than I start searching for your name. With Nick Paterman there are not much
only with that other nick.

I find this so nice writing. "Nick has now changed his nick in Nick", The
previous was more distinct.

However I have pasted your code (slightly changed because I don't have that
class that you use) in a form

I get two messageboxes showed each over each other, so the problem is in my
idea not in this code part.

\\\
Private Sub cTrdImportThread_Callback()
MessageBox.Show("Hello??")
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cTrdImportThread As New Threading.Thread(AddressOf
cTrdImportThread_Callback)
With cTrdImportThread
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThread.Start()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
MessageBox.Show("Thread started!, state = " &
cTrdImportThread.ThreadState.ToString & ".")
End Sub

I hope it helps something

Cor
Nov 21 '05 #2

P: n/a
Hi Cor,
We have a long time not seen, I see this when there are licence problems,
than I start searching for your name. With Nick Paterman there are not
much only with that other nick.

I find this so nice writing. "Nick has now changed his nick in Nick", The
previous was more distinct.
Yeah I thought it best to change my name from Nak to Nick, just incase
someone decides to accuse me of concealing my identity again, not that I
have any need to of course. :-)
\\\
Private Sub cTrdImportThread_Callback()
MessageBox.Show("Hello??")
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cTrdImportThread As New Threading.Thread(AddressOf
cTrdImportThread_Callback)
With cTrdImportThread
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThread.Start()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
MessageBox.Show("Thread started!, state = " &
cTrdImportThread.ThreadState.ToString & ".")
End Sub


That's has produced to stranges results ever, from changing the name
from something that previously worked to something to "whatever" causes the
thread to start in about 10 seconds after start is called!! The application
is at rest when start is called so I'm really confused as to what is
actually happening there. But the good thing is that it is actually doing
something now! :-D

Thanks loads for your help, looks like i'm going to have to search a
little deeper into this problem :-\

Nick.
Nov 21 '05 #3

P: n/a
Actually just to add another element of confusion to that, on another system
the thread never starts! woooooooooo.....

"Nick" <no****@altavente.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi Cor,
We have a long time not seen, I see this when there are licence problems,
than I start searching for your name. With Nick Paterman there are not
much only with that other nick.

I find this so nice writing. "Nick has now changed his nick in Nick", The
previous was more distinct.


Yeah I thought it best to change my name from Nak to Nick, just incase
someone decides to accuse me of concealing my identity again, not that I
have any need to of course. :-)
\\\
Private Sub cTrdImportThread_Callback()
MessageBox.Show("Hello??")
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cTrdImportThread As New Threading.Thread(AddressOf
cTrdImportThread_Callback)
With cTrdImportThread
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThread.Start()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
MessageBox.Show("Thread started!, state = " &
cTrdImportThread.ThreadState.ToString & ".")
End Sub


That's has produced to stranges results ever, from changing the name
from something that previously worked to something to "whatever" causes
the thread to start in about 10 seconds after start is called!! The
application is at rest when start is called so I'm really confused as to
what is actually happening there. But the good thing is that it is
actually doing something now! :-D

Thanks loads for your help, looks like i'm going to have to search a
little deeper into this problem :-\

Nick.

Nov 21 '05 #4

P: n/a
Well I've found the problem now and it was completely unrelated to the
treading code. I was using incorrect versions of some primary interop DLL's
which were either not loading at all or taking ages to load! Though one
thing I am unsure of is why the DLL was being loaded when the thread was
being started as opposed to when the class was initialized. Anyway, a
problem sorted none the less :-)

Nick.
"Nick" <no****@altavente.com> wrote in message
news:OV**************@TK2MSFTNGP14.phx.gbl...
Actually just to add another element of confusion to that, on another
system the thread never starts! woooooooooo.....

"Nick" <no****@altavente.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi Cor,
We have a long time not seen, I see this when there are licence
problems, than I start searching for your name. With Nick Paterman there
are not much only with that other nick.

I find this so nice writing. "Nick has now changed his nick in Nick",
The previous was more distinct.


Yeah I thought it best to change my name from Nak to Nick, just incase
someone decides to accuse me of concealing my identity again, not that I
have any need to of course. :-)
\\\
Private Sub cTrdImportThread_Callback()
MessageBox.Show("Hello??")
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim cTrdImportThread As New Threading.Thread(AddressOf
cTrdImportThread_Callback)
With cTrdImportThread
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThread.Start()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
MessageBox.Show("Thread started!, state = " &
cTrdImportThread.ThreadState.ToString & ".")
End Sub


That's has produced to stranges results ever, from changing the name
from something that previously worked to something to "whatever" causes
the thread to start in about 10 seconds after start is called!! The
application is at rest when start is called so I'm really confused as to
what is actually happening there. But the good thing is that it is
actually doing something now! :-D

Thanks loads for your help, looks like i'm going to have to search a
little deeper into this problem :-\

Nick.


Nov 21 '05 #5

P: n/a
Nick,

Are you sure you want to set that IsBackGround to false, I assume that you
want True

Cor
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.