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

  • SEARCH
  • Home
  • 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 6133891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:17:14+00:00 2026-05-23T17:17:14+00:00

When my project starts Form1 loads and checks the program license with the server,

  • 0

When my project starts Form1 loads and checks the program license with the server, if everything’s OK it should: show Form2 and close Form1. Afterward when the user would close Form2 with the “x”, the program should end.

What do you think would be the best way of doing it?

So far got only to form2.Show 🙂

...
if (responseFromServer == "OK")
{
    Form2 form2 = new Form2();
    form2.Show();
}

Thanks!

  • 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-23T17:17:15+00:00Added an answer on May 23, 2026 at 5:17 pm

    As you probably know if you use Form1 as your main form then you can’t close it as this will close the application (unless you customize the way the app starts, but that’s more advanced).

    One option is to start by creating Form2 as your main form, but keep it hidden, then create and show Form1, and then when the license check is finished, close Form1 and make Form2 visible.

    Or you can start by showing Form1 and then when the license check is done, call Form1.Hide() and then create and show Form2. Then when Form2 is closed by the user, call Form1.Close() in the Form2.Closed event handler:

    class Form1
    {
        private void Form1_Load(object sender, EventArgs e)
        {
            // do the license check, 
            // and then when the license check is done:
            if (responseFromServer == "OK")
            {
               Form2 form2 = new Form2();
               Form2.FormClosed += new FormClosedEventHandler(Form2_FormClosed);
               Form2.Show();
               this.Hide();
           }
           else
               this.Close();
        }
    
    
        private void Form2_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.Close(); // will exit the application     
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an integration testing project in .NET. The testing framework executable starts
I have a project that loads 3rd party modules (in the form of DLLs)
I have a project which starts and stops a service. Most of the times
I am using XCode 4.0.2 for a iOS4 project. When my app starts, the
I get the following error when running my Visual Studio 2008 ASP.NET project (start
I'm about to start a project for a customer who wants CMS-like functionality. They
I'm about to start a project that will record and edit audio files, and
I am about to start a project for a potentially heavily accessed ASPNET MVC
In few months I start a project in PHP and I am hesitating to
I'm about to start a project that requires XML messages to be sent between

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.