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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:54:40+00:00 2026-05-16T22:54:40+00:00

I am using Visual Studio 2010, C# .NET 4.0. I have 3 forms: Form1,

  • 0

I am using Visual Studio 2010, C# .NET 4.0. I have 3 forms: Form1, Form2, Form3.

In Form1 I have a button to open Form2:

private void button1_Click(object sender, EventArgs e)
{
    Form2 f = new Form2();
    f.Show();
}

In Form2 I have a private Form3 variable always pointing to the same Form3:

private Form3 f = new Form3();

And a button to open it as a dialog:

private void button1_Click(object sender, EventArgs e)
{
    f.ShowDialog();
}

In Form3 I just have a button to hide the form:

private void button1_Click(object sender, EventArgs e)
{
    this.Hide();
}

The problem is that having the situation that Form2 is in front of Form1, and Form3 in front of Form2, when I click the button of Form3 to hide it, it not only hides itself but sends Form1 to the back of all of the other Windows.

This only happens when there is a window of another program (such as Windows Explorer) in the background of Form1. It seems like a bug. What do you think?

  • 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-16T22:54:41+00:00Added an answer on May 16, 2026 at 10:54 pm

    Yes, this cannot work properly by design. A dialog disables all of the windows that your program displays. So that it is modal. When you hide the dialog, there are no windows left that can get the focus. Windows is forced to find another window to give the focus to. That will be a window owned by another application. Your own windows will now hide behind it.

    There are more side effects, the dialog will also close. Necessary because otherwise the user can never get back to your program anymore since all windows are disabled. This is all unsurprising behavior. Bug would be a strong word, but it would of course work better if it first re-enabled all windows before closing the dialog. But closing the dialog is already undesirable behavior.

    Don’t call Hide() for a dialog. Just set the DialogResult property to DialogResult.Cancel to achieve the exact same effect, minus the focus problem. You do have to reset it back to None if you want to display the dialog again. That’s a real bug.

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

Sidebar

Related Questions

I have a asp.net website with c# code behind and using visual studio 2010.
I'm using Visual Studio 2010 / VB / dot net 4.0, and I have
I have created a web application using ext.net and c# in visual studio 2010.
Using Visual Studio 2010 and .NET framework 4.0 I have built a simple HelloWorld
I am running Visual Studio 2010, using an ASP.Net forms application.I am trying to
I'm using ASP.NET web forms in Visual Studio 2010. How can I create UI
I'm using Visual Studio 2010 RTM with .NET/Entity Framework 4 RTM with a model
Using ASP.net and c# using visual studio 2010 Hi all, I hope some one
I'm using the Visual Studio 2010 RC for .NET 4.0 and I'm trying to
I am using Visual Studio 2010 to create a setup project for my .NET

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.