473,398 Members | 2,380 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,398 software developers and data experts.

Checking the Status of a Thread

Hi Everyone;

I have a bit of a problem with a Windows form application, when run the
application creates a worker thread to do the bulk of the socket
communication. On the form I have a timer control, which I want to be
able to use to to get the status of the thread.

Here is my code;

namespace IrcBot
{
public partial class IrcBot : Form
{
Thread myTObject;
IRCThread myIRC;

.........
private void btnConnect_Click(object sender, EventArgs e)
{
try
{
this.btnConnect.Enabled = false;
this.btnDisconnect.Enabled = true;
myIRC = new IRCThread(txtBotName, txtRealName,
txtServer, txtChannel, txtPort);

myTObject = new Thread(new
ThreadStart(myIRC.IRCFunctions));

myTObject.Name = "Micks Thread";

myTObject.Start();
}
catch (FormatException fEx)
{
// to do
}

catch (Exception ex)
{
// to do
}

}

private void timThread_Tick(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = myTObject.IsAlive.ToString() ;

}

}
}

This doesnt display if the thread is running or not on the tool strip
ststus label.
Does anyone know where I am going wrong?
Mar 26 '06 #1
0 1006

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

Similar topics

6
by: Abubakar | last post by:
Hi, lets say I have a connected SOCKET s. At some point in time, I want to know if the "s" is still valid, that it is still connected. Is there any API that I can give me this information? And...
2
by: Mike | last post by:
Hello, Ok I have 2 classes in my project, one is the main form and one is a connection class, at a certain event on my main form a new instance is made of the connection class, and a reference...
1
by: =?Utf-8?B?Um9nZWxpbw==?= | last post by:
hey, I have a status bar, and a timer control, and a statc variable. every 0.5 seconds, the timer sets the status bar text to the variable. then I can just change the variable's value whenever...
9
by: tshad | last post by:
I have a Windows App that is doing some work and then writing a "Now Processing..." line to the status line of the window as well as the Textbox on the form. But the problem is that the work is...
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: 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
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.