Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3480792
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:23:10+00:00 2026-05-18T10:23:10+00:00

I am doing an application a Windows Form application. At first, a certain form

  • 0

I am doing an application a Windows Form application. At first, a certain form appears, and after the user hits the next button, this form should be hidden and another form is shown.

I tried to do it. I managed to hide the current form, but the next one won’t show.

Here is my attempt:

This is the button’s event handler

private void button1_Click_1(object sender, EventArgs e)
{
    if (richTextBox1.Text != null)
    {
        this.Visible=false;


    }
    else
        MessageBox.Show("Insert Attributes First !");
}

This is the main function:

static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Form2 form2 = new Form2();
    Form1 form1 = new Form1();
    form2.Hide();
    Application.Run(form1);
    while (true)
    {
        if (form1.Visible == false)
            form2.Show();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:23:11+00:00Added an answer on May 18, 2026 at 10:23 am

    The While statement will not execute until after form1 is closed – as it is outside the main message loop.

    Remove it and change the first bit of code to:

    private void button1_Click_1(object sender, EventArgs e)  
    {  
        if (richTextBox1.Text != null)  
        {  
            this.Visible=false;
            Form2 form2 = new Form2();
            form2.show();
        }  
        else MessageBox.Show("Insert Attributes First !");  
    
    }
    

    This is not the best way to achieve what you are looking to do though. Instead consider the Wizard design pattern.

    Alternatively you could implement a custom ApplicationContext that handles the lifetime of both forms. An example to implement a splash screen is here, which should set you on the right path.

    http://www.codeproject.com/KB/cs/applicationcontextsplash.aspx?display=Print

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an application (Windows Form) that allows the user to take a screenshot
What tools are useful for automating clicking through a windows form application? Is this
I am trying to submit a form using jsRoutes in ajax after first doing
I'm developing a PhoneGap application for Windows Phone 7 and I'm doing some jQuery
We have a business application written for Windows mobile. It has people doing inventories.
Iam doing one application in iphone.In this i need to get the browsing history
In a Windows Form application, I'm trying to create a DataGridView with two columns:
I have a Windows form application that users can log into. The application is
Title is pretty self-explanatory. I've got a DataGrid for a Windows Form Application, and
I want to make a windows mobile 6 cellphone application. This application will talk

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.