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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:07:40+00:00 2026-05-26T23:07:40+00:00

I have a system in which the main form is the menu, and it

  • 0

I have a system in which the main form is the menu, and it pops up a login form on loading.
Originally it loaded the login form below the menu, so I used this.topmost = true to make it come to the front. (as bring to front and send to back did not work)

However, if the user then clicks on something else, say chrome, then it still stays at the top of the z-order, by definition of topmost.

I tried to use the deactivate event, but this meant that on load it once again comes up behind the menu form.

How could I stop it from loading behind my menu form, and yet when it loses focus stop it from being topmost?

private void login_Deactivate(object sender, EventArgs e)
{
     // do not want it to remain top most when the application is not in focus.
     this.TopMost = false;
}

In the Menu form:

private void Menu_Load(object sender, EventArgs e)
{
     openLogin()
}

private void openLogin()
{
     Cursor.Current = Cursors.WaitCursor;
     login theForm = new login(this);            
     this.Enabled = false;            
     theForm.Show();
     Cursor.Current = Cursors.Default;
     theForm.Activate(); 
     theForm.TopMost = true; // Make the login form display over the Menu    
}          
  • 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-26T23:07:40+00:00Added an answer on May 26, 2026 at 11:07 pm

    Try setting Login’s Form Owner property to the menu form.

    From above MSDN link:

    When a form is owned by another form, it is closed or hidden with the
    owner form. … Owned forms are also never displayed behind their
    owner form
    . You can use owned forms for windows such as find and
    replace windows, which should not disappear when the owner form is
    selected. To determine the forms that are owned by a parent form, use
    the OwnedForms property

    .

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

Sidebar

Related Questions

I have a web system which has a classical parent-children menu saved in a
We are an organisation who have purchased a system which is used by doctors
I am using a System.Windows.Forms.Timer component on an application's main form which checks every
I have a frame which I use as the main form (mainFrame), it inherits
I have a main page which looks like: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage
I have a main form, which is invisible and at some point creates a
I have a main thread that creates a form object which creates and sets
Hi i have a login which connects to a server string and executes this
I have a windows forms project. It has a main form derived from System::Windows::Forms::Form
I have a system which sits on a web server and generates files on

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.