Show two windows forms one after the other

Partha Mandayam 91 Reputation points
2022-11-10T06:54:16.143+00:00

I want to show 1 windows form for 15 seconds and then close that and show another windows form
How to do that?

Developer technologies | Windows Forms
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-11-11T02:28:58.25+00:00

    Hi @Partha Mandayam , Welcome to Microsoft Q&A, you could try the following code to get what you wanted.

    You only need a simple timer control to achieve the effect you want, and the test interval here is 200ms;

    Form.Hide() only hides the ui and does not stop the window.

    public Form2 form2 = new Form2();  
    public bool flag = true;  
    private void timer1_Tick(object sender, EventArgs e)  
    {  
    	if (flag)  
    	{  
    		this.Show();  
    		form2.Hide();  
    		flag = false;  
    	}  
    	else  
    	{  
    		this.Hide();  
    		form2.Show();  
    		flag = true;  
    	}  
    }  
    

    enter image description here]

    Best Regards,
    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.