how to close a form at runtime in a window application

Hi experts,

my question is that As i click ona button the following should be happen

1.a form should be open that .this form will be there for almost 3-4 second on screen after this ,that form will be closed.
2. As it close a new form will be opened.

how could we done it in c# window applicatiopn.

Please let me know about it ASAP.
ASINGH1974Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gikamCommented:
it;s a problem if it's made in delphi?
0
ASINGH1974Author Commented:
actually i want this functionality in c#, window application
0
Snarf0001Commented:
Just so i understand, for example:

from Form1, you press a button
that opens Form2, which lingers for 4 seconds
when it closes, it launches Form3?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

ASINGH1974Author Commented:
yes, you are saying right.
i want this type of functionality
0
Snarf0001Commented:
Okay, should be done the easiest with a timer.
In Form1 on the button click, launch Form2 as you would any other:

private void button1_Click(object sender, EventArgs e)
{
    new Form2().Show();
}


Then in add an event for the Form2 Load in it's code behind, and hook up as follows:

private void Form2_Load(object sender, EventArgs e)
{
    //create a timer for the 4 second delay and wire up and event handler for the tick event
    Timer t = new Timer();
    t.Interval = 4000;
    t.Tick += new EventHandler(Timer_Tick);
    t.Start();
}
protected void Timer_Tick(object sender, EventArgs e)
{
    //on the tick event, kill the timer, make this form invisible, launch the 3rd form, and then close this one
    ((Timer)sender).Dispose();
    this.Visible = false;
    new Form3().Show();
    this.Close();
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ASINGH1974Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.