473,395 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Thread just wont start!!?!?!

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
5 1019
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
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
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
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
Nick,

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

Cor
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: D Witherspoon | last post by:
My application takes 5 or 6 seconds to load because of the time required to communicate with web services and load from the database. In the meantime I'd like to show a splash screen in a seperate...
5
by: Doug Kent | last post by:
Hi, I am using a STA thread to run a COM object. On a couple of machines the thread runs fine. On another machine the thread won't start, and no exceptions are thrown. This code is running...
8
by: sir dd | last post by:
Hi, I've got a Windows-service that runs nice and smooth on my local machine, but when installed on a server it fails to start the thread inside. I can't figure out what's wrong. The code below...
5
by: taylorjonl | last post by:
I am completely baffled. I am writting a daemon application for my work to save me some time. The application works fine at my home but won't work right here at work. Basically I have a...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
4
by: =?Utf-8?B?UGhpbA==?= | last post by:
I have a dll that I call to start a thread that will monitor a serial port and then process and store the data received from that port. On most every computer I have run this on, the program...
12
by: Tom Burton | last post by:
Help! Some of you may remember me from a few weeks ago when I was first starting to play with CSS and made rather a large mess.. Never the less I stuck with it and have put a site together,...
3
by: =?Utf-8?B?UmF5?= | last post by:
Hello. I have a c# service with four threads. Sometimes one of them just don't start, I don't know why. It happened with any of the four threads, and just in production environment, not in...
1
by: ziycon | last post by:
I have a batch file and all it does is stop a service call the deltree file to empty a directory and the start the service but its wont start the service back up. The first two lines run a fine,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.