C#.Net How to Set Progress bar for DeskTop Application

C#.Net How to Perform progressbar operation  with using Timer in desk top application

Introduction : This Artical Explain How to perform progressbar operation with the time and how forms are hiden and new form are show in Desk top application. 

Step 1 : Create windowform  project  and add progessbar and timer  in form1.cs and add button.form is given below with sample code and add second form give name as Home.cs
























  in form load event you can set progressbar value=0 and than set timer value in timer_tick event  as code given below.

 namespace ProgressbarDemo
{
    public partial class Form1 : Form
    {
     
        public Form1()
        {
            InitializeComponent();
        }
   
        private void Form1_Load(object sender, EventArgs e)
        {
            progressBar1.Value = 0;

        }
        private void timer1_Tick(object sender, EventArgs e)
        {
           
        if (progressBar1.Value < 100)
            {
                progressBar1.Value += 5;

            }
            else
            {
                this.Hide();
                 Home h1 = new Home();
                h1.Show();
                timer1.Enabled = false;
             }
        }

        private void progressBar1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form1 F1 = new Form1();
            F1.Show();
        }               
    }
}
When you run project form can be shown as below

 




Previous
Next Post »