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 6665959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:46:42+00:00 2026-05-26T02:46:42+00:00

I have a form1 that opens form2 as a fake popup this.enabled = false;

  • 0

I have a form1 that opens form2 as a “fake popup”

this.enabled = false;
MyForm2 myform2 = new MyForm2();
myform2.Show();
myform2.BringToFront();

When i dispose form2 i enable form1 back.

Now if the user minimizes both forms, and then clicks on form1, form1 will pop in his disenabled state.
I need to pop form2 insted.

So I created a static class to hold my last active form. On load of form2(or any other form) i save my last active form.

protected override void OnLoad(System.EventArgs e)
{
   base.OnLoad(e);
   MyStaticClass.lastForm = this;
}

In form1(and other similar forms) i use:

    protected override void OnGotFocus(System.EventArgs e)
    {
        base.OnGotFocus(e);
        if (!this.Enabled && MyStaticClass.lastForm!= null && MyStaticClass.lastForm != this)
        {
           MyStaticClass.lastForm.Show();
            MyStaticClass.lastForm.BringToFront();
            MyStaticClass.lastForm.Activate();
        }
    } 

OnGotFocus gets executed and my show/activate etc does too, but form2 never pops up. What am I doing wrong?

Thank you,
gg

  • 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-26T02:46:42+00:00Added an answer on May 26, 2026 at 2:46 am

    You are “showing” and “activating” your form, the problem is it’s still minimized. Change the WindowState to Normal.

    MyStaticClass.lastForm.WindowState = FormWindowState.Normal;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want my Form1 to have a Options button that opens up Form2. In
I have application in VB.net that have two different form (Form1 and Form2). Now
I have three forms named frmBase(form1),frmGraph(form2) and frmBalloon(form3). frmGraph(form2) opens if the user clicks
Right now i have 2 forms. On Form1 i open up Form2 like this:
I have an app that opens a non-modal form from the main form. The
I have a form (Form1) that has a NotifyIcon on it. I have another
There I have a button_click event and when it happens it opens a new
I currently have a parent control (Form1) and a child control (Form2). Form1 contains
My application looks like this: I have an MDI parent form - form1, the
I have a Form1 that has a button on it. When the button is

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.