473,800 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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()
cTrdImportThrea d = New Threading.Threa d(AddressOf
cTrdImportThrea d_Callback)
With cTrdImportThrea d
.Name = Tiger_AssemblyI nfo.assemblyRoo tNamespace &
".PowerPointImp orter"
.IsBackground = False
End With
Try
Call cTrdImportThrea d.Start()
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try
MessageBox.Show ("Thread started!, state = " &
cTrdImportThrea d.ThreadState.T oString & ".")
End Sub

Private Sub cTrdImportThrea d_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 1045
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 cTrdImportThrea d_Callback()
MessageBox.Show ("Hello??")
End Sub

Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim cTrdImportThrea d As New Threading.Threa d(AddressOf
cTrdImportThrea d_Callback)
With cTrdImportThrea d
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThrea d.Start()
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try
MessageBox.Show ("Thread started!, state = " &
cTrdImportThrea d.ThreadState.T oString & ".")
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 cTrdImportThrea d_Callback()
MessageBox.Show ("Hello??")
End Sub

Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim cTrdImportThrea d As New Threading.Threa d(AddressOf
cTrdImportThrea d_Callback)
With cTrdImportThrea d
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThrea d.Start()
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try
MessageBox.Show ("Thread started!, state = " &
cTrdImportThrea d.ThreadState.T oString & ".")
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****@altaven te.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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 cTrdImportThrea d_Callback()
MessageBox.Show ("Hello??")
End Sub

Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim cTrdImportThrea d As New Threading.Threa d(AddressOf
cTrdImportThrea d_Callback)
With cTrdImportThrea d
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThrea d.Start()
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try
MessageBox.Show ("Thread started!, state = " &
cTrdImportThrea d.ThreadState.T oString & ".")
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****@altaven te.com> wrote in message
news:OV******** ******@TK2MSFTN GP14.phx.gbl...
Actually just to add another element of confusion to that, on another
system the thread never starts! woooooooooo.... .

"Nick" <no****@altaven te.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.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 cTrdImportThrea d_Callback()
MessageBox.Show ("Hello??")
End Sub

Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim cTrdImportThrea d As New Threading.Threa d(AddressOf
cTrdImportThrea d_Callback)
With cTrdImportThrea d
.Name = "whatever"
.IsBackground = False
End With
Try
Call cTrdImportThrea d.Start()
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try
MessageBox.Show ("Thread started!, state = " &
cTrdImportThrea d.ThreadState.T oString & ".")
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
7912
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 thread. I am trying the following code and it shows the form for a split second and then dissapears. Can someone help me out with what I'm doing wrong here. Thanks, Dan
5
1633
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 in a web service implemented using C#, ASP.NET 1.1, IIS 5.1, Windows 2000 Server.
8
1376
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 executes as it should on my machine: test123 is written to the eventlog, but it's not on the server where it should be installed. It has however run for a few days on the server, but just stopped one day (perhaps after a reboot?). The eventlog...
5
2222
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 MainForm what has a Start/Stop button that starts and stops the processing thread. private void StartButton_Click(object sender, System.EventArgs e) { if( bStopSignal ) { // disable controls that aren't valid when running
4
21767
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 webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
4
4122
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 works perfectly. However, I have a Panasonic CF-51 laptop that fails when I try to launch the thread. It works on other CF-51's, it only fails on this particular computer. I get no exceptions; it simply reports the threadstate as Stopped.
12
2482
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, simple it my be, correct I doubt, but none the less it is beginning to come together. I am however stuck here....
3
2612
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 development environment. Any idea? Best regards, Ray
1
2571
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, service stops, specified directory is emptied out and it ends with no errors and the service hasn't been started. Any ideas/help much appreciated. NET STOP "service_name" DELTREE "C:\temp\" NET START "service_name"
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.