Need help in threading
Hi all,
Could somebody pls clear my thread concept with very simple programing in c#???
Thanks,
India
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mahesh ChandRank #1 · 393.3K reputationPosted Jul 25, 2009, 5:08 PM EDT
Writing Your First Multithreading Application by Mahesh Chand on Jan 31, 2006
If you have never written a multithreading application in C# or .NET, this application might be helpful for you.
Multithreading for Beginners by Mahesh Chand on Jan 31, 2006
This tutorial for beginners who wants to write their first multithreaded applications in C# and .NET.
Multithreading in C# by Bhaskar Gollapudi on Oct 01, 2008
This article discusses how to write multithreading applications in C#. Part I of this series will discuss the basics of threads in .NET.
Multithreading with C# by Udeshika Horanagama on Feb 25, 2009
This article gives you an introduction to write multithreaded applications with c# and some basic ways for creating threads
Multithreading in C# - A Demo by Chuck Iyer on Mar 13, 2009
This program illustrates multithreading in C# using a maximum of six elevators and a minimum of one elevator in a building that can have a maximum of eight floors and a minimum of two floors.
Danatas GerviRank #4,152 · 361 reputationPosted Jul 28, 2009, 8:30 AM EDT
//This is simple example of thread using // on Form1 - only Label And Textbox - I hope, you know how to add event handlers from Designer... using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; namespace ThreadTakesDataFromString { public partial class Form1 : Form { Thread m_OtherThread; string masterCommand; public Form1() { InitializeComponent(); m_OtherThread = new Thread(new ThreadStart(HardWork)); m_OtherThread.Start(); } private void HardWork() { string currentCommand = ""; while (masterCommand != "exit") { if (currentCommand != masterCommand) { SetText(label1, "I have got "); currentCommand = masterCommand; } else { SetText(label1, "Continue work!"); } Thread.Sleep(400); } } delegate void OnTextChange(Label labelForChange, string moreText); void SetText(Label labelForChange, string moreText) { if (labelForChange.InvokeRequired) { OnTextChange tsDelegate = new OnTextChange(SetText); labelForChange.Invoke(tsDelegate, new object[] { labelForChange, moreText }); } else { if (label1.Text.Length > 300) { label1.Text = ""; } label1.Text += moreText+ "\n"; } } private void textBox1_TextChanged(object sender, EventArgs e) { masterCommand = textBox1.Text; } } }