January 23, 2016

Designing a welcome screen in C#.net

Controls needed 

1. Progress bar
2. Timer control

Set the Maximum property of Progress bar to 110

and on timer1_Tick. Use the following code


private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar1.Value = progressBar1.Value + 10;
            if (progressBar1.Value == 110)
            {
                timer1.Enabled = false;
                Login frm2 = new Login();
                frm2.FormClosed += new FormClosedEventHandler(frm2_FormClosed);
                frm2.Show();
                this.Hide();
            }
        } 


To close the parient form from child form use FormClosedEventHandler

 private void frm2_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.Close();
        }

No comments:

Post a Comment