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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:26:50+00:00 2026-05-26T06:26:50+00:00

Relates to my previous question . In my previous question I asked why my

  • 0

Relates to my previous question.

In my previous question I asked why my dialogs seem to be opening behind other windows. (Other windows not necessarily belonging to my program, e.g. Excel, Windows Explorer, etc.)

I was told to use the overloaded ShowDialog() and pass the parent as a parameter.

That’s fine, and I’ve replaced all the ShowDialog()s with the overload.

However I still had the same problem here:

static class Program
{
  /// <summary>
  /// The main entry point for the application.
  /// </summary>
  [STAThread]
  static void Main()
  {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);

    OpenFileDialog ofd = new OpenFileDialog();
    ofd.ShowDialog(); // First dialog

    // Do some stuff here...

    SaveFileDialog sfd = new SaveFileDialog();
    sfd.ShowDialog(); // Second dialog;
  }
}

In this example (don’t comment on the code – I just wrote it up as a simple example), the user double-clicks the executable with several windows on their screen. The OFD appears on top, and the SFD appears underneath everything.

I usually have this sort of OFD/SFD set up in my simple programs which accept CSV or XLS files and do some simple processing of them. In this case, I put the OFD code in the static Main() method and load the dialog if no parameters were passed to the exe.

  • 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-26T06:26:50+00:00Added an answer on May 26, 2026 at 6:26 am

    Modal Dialog boxes aren’t meant to be used this way, although there’s nothing stopping you from doing it anyway.

    You must have an Application.Run as shsmith said.

    For the simple example you gave in the question I would have a small window show up with a progress bar and/or rolling log status text.

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

Sidebar

Related Questions

This is a related to a previous question I have asked here, see the
This question is related to a previous question I asked, but it's a different.
This is related to a previous question I asked with Jquery. If I have
This relates to my previous question (which can be viewed here ). I'd like
This code is taken from a previous question, but my question directly relates to
This question relates to Francois Deschenes's answer to one of my previous questions. I
This question relates to a previous question here: Reducing number of calls to the
This is closely related to a previous question i asked. I have a many-to-many
(Related to a previous unanswered question I asked). I want to implement a function
This is kind of related to my previous question, but not really. I have

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.