C# (C-Sharp) is a programming language developed by Microsoft that runs on the .NET Framework. And widely used for developing desktop application, web application and third party application like Web Services and API’s Application.

This topics is all about C# building application and using Thread functionalities. if you want to more updated blogging topic here. please to subscribes your email to be updated.

Thread is a execution path of a program. Every thread defines a unique flow of control. If the application involves a complicated and time consuming operations, then it is often to helpful to set different execution paths or threads.

Two type of Thread;

  • Main Thread or Mother,
  • Child Thread

Main Thread or Mother,

In C#, the System.Threading.Thread class is used for working with threads. It allows creating and accessing individual threads in a multithreaded application. The first thread to be executed in a process is called the main thread.

Child Thread

When a C# program starts execution, the main thread is automatically created. The threads created using the Thread class are called the child threads of the main thread. You can access a thread using the CurrentThread property of the Thread class.

Now we are create Application and also Child Thread in;

using System.Threading;

Declare Thread in global for easy access in every function

Thread childThread;

and create internal class function

/// <summary>
        /// this function move every run
        /// </summary>
        public void functionThread_one()
            moving += 1;

            switch (moving)
                case 1:
                    label2.Text = moving.ToString();
                case 2:
                    label3.Text = moving.ToString();
                case 3:
                    label4.Text = moving.ToString();
                case 4:
                    label5.Text = moving.ToString();
                case 5:
                    label6.Text = moving.ToString();
                case 6:
                    label7.Text = moving.ToString();
                case 7:
                    moving = 0;

condition function every 2 mins.

 if (Int32.Parse(DateTime.Now.Minute.ToString()) / 2 == 0)
                childThread = new Thread(functionThread_one);

Related Topics

Leave a Reply

Your email address will not be published. Required fields are marked *