Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how to close a form at runtime in a window application

Posted on 2008-11-20
6
Medium Priority
?
772 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:ASINGH1974
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:gikam
ID: 23002798
it;s a problem if it's made in delphi?
0
 

Author Comment

by:ASINGH1974
ID: 23002849
actually i want this functionality in c#, window application
0
 
LVL 23

Expert Comment

by:Snarf0001
ID: 23003714
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ASINGH1974
ID: 23004049
yes, you are saying right.
i want this type of functionality
0
 
LVL 23

Accepted Solution

by:
Snarf0001 earned 1500 total points
ID: 23004352
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
 

Author Closing Comment

by:ASINGH1974
ID: 31518645
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question