Click here to Skip to main content
15,921,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wanna show to user the number of the threads of my Application that are running now (live in a textbox) . :sigh:
How can I do that?

Edit::
thanks Jimmanuel but where should I use this snippet code to show my thread
lively ?
Posted
Updated 12-Mar-10 17:59pm
v2

One way:
C#
using (Process p = Process.GetCurrentProcess())
{
    MessageBox.Show(p.Threads.Count.ToString());
}
 
Share this answer
 
You can use Windows Task Manager

Goto:
Processes tab - > View - > Select Columns...-> Threads Count

New column will be added to Processes tab. This column will display a number of thread of selected process
 
Share this answer
 
The easiest way to update a TextBox every so often is to add a Windows.Forms.Timer to your Form and then in the callback function use the snippet I posted to update the TextBox text instead of showing a MessageBox. Just drag and drop a Timer from the Toolbox onto your Form in the VS Form designer, and then you can edit the Timer's properties and events from there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900