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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:20:58+00:00 2026-05-10T17:20:58+00:00

MessageBox.Show has forms like MessageBox.Show( ownerWindow, …. ). What do I gain by assigning

  • 0

MessageBox.Show has forms like MessageBox.Show( ownerWindow, …. ).

What do I gain by assigning a owner window?

  • 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. 2026-05-10T17:20:58+00:00Added an answer on May 10, 2026 at 5:20 pm

    A message box is a modal form, which means that its parent window is disabled until the message box is dismissed.

    If a Show() overload is called that does not take an owner identifier, then a parent form is usually chosen automatically. I can’t find anything in the documentation that describes how that form is chosen, but my experience is that if the message box is displayed inside the GUI thread (i.e., the main thread, or message pump thread), then the active window for that thread is chosen as the parent.

    Other threads may create message boxes with no parent form. This could be a bad situation, because it could sit behind the active window, and the user will not even know it is there until they close the program. To avoid this, you could pass the handle of the application’s main window to the Show method, which will disable that window for the duration of the message box.


    ADDED: I’ve been thinking about this and now I’m not so sure. The snippet from reflector that you gave below makes me think that maybe the thread doesn’t matter. (I did say that I couldn’t find anything in the documentation!)

    I’d have to go back and look at the code to make sure, but I think the message boxes that I used to lose behind the main form may have actually been custom message box forms, in which case my experience is faulty, and you never ever have to supply a parent form parameter.

    Sorry for the confusion.

    My recommendation now is to never supply this parameter unless you need something other than the active window to be the main form.

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

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Listen for the onsubmit event on the form and return… May 11, 2026 at 1:04 pm
  • added an answer It should be something like: var result = from artist… May 11, 2026 at 1:04 pm
  • added an answer Of course other answers are valid. But if you want… May 11, 2026 at 1:04 pm

Related Questions

MessageBox.Show has forms like MessageBox.Show( ownerWindow, .... ). What do I gain by assigning
I have an MDI application. When I show a message box using MessageBox.Show(), the
I have a file called hellowf.cs class MyFirstApp { static void Main() { System.Windows.Forms.MessageBox.Show(Hello,
I'm using the MessageBox class to show errors to users, and while that might
I want to show a message box when users trying to do any major
Ok, this is bugging me, and I just can't figure out what is wrong...
I have an application that has a main form and uses an event handler
I'm fairly new to C# programming. I am making a program for fun that
Bound GetChanges always returns something when bound to a UserControl 's property (even on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.