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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:13:39+00:00 2026-05-11T17:13:39+00:00

Is there a way to start off showing a dialog modally, but then instead

  • 0

Is there a way to start off showing a dialog modally, but then instead of hiding it, to keep it visible while changing it to a non-modal dialog?

I want to show a dialog, blocking the method that shows the dialog. Then when the user clicks the ‘Finish’ button on the dialog I want:

  • The dialog to remain visible.
  • Control to return to the method that showed the dialog.

I’ve achieved this result by running the dialog on a separate STA thread, and using an event to block the main UI thread until ‘Finish’ is pressed, but there’s a catch to this method: you can click on the close button of the ‘main’ window while the dialog is visible, and the main window closes when the dialog is hidden.

Update

Thanks for the responses so far. Sorry – it looks like I got the balance wrong between too much background and not enough.

The form is effectively a modal ‘wizard’ dialog – it appears, sits in front of the main app modally, and then is hidden. So as far as the user’s concerned there’s no non-standard weirdness going on. The only difference is that the dialog is driven from a series of callbacks from the UI thread, so I don’t think making it truly modal (via a call to ShowDialog) for its lifetime would work. The first callback must show the dialog, and then block while the user sets their preferences via the dialog UI. After that, the dialog stays visible and displays a progress bar page while various other callbacks are made from the UI thread. Eventually the form is hidden. The user isn’t interacting with the main window while the form is up. As far as they’re concerned, it should appear to be 100% modal wrt the main UI thread.

(The form is a dialog for a Visual Studio wizard – these are driven from a series of callbacks on the UI thread). An alternative would be to show the dialog, hide it, immediately show a topmost ‘progress’ form instead and then hide that, but I think showing a single dialog is more seamless an experience for the user.

Again – sorry for the confusion!

  • 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-11T17:13:39+00:00Added an answer on May 11, 2026 at 5:13 pm

    I found that showing an an invisible modal dialog on the main UI thread during the blocking stage of the interaction works great.

    Hidden modal dialog settings (so it’s not visible): ShowInTaskBar=false, FormBorderStyle=None, size={0,0}, Opacity=0%, StartupPosition=CenterParent.

    The hidden dialog is shown on the UI thread using ShowDialog. The visible dialog is shown on a separate STA thread. The thread is kicked off before calling hiddenDialog.ShowDialog on the main UI thread.

    The visible dialog hides hiddenDialog when it wants the initial blocking state to complete. This stops the main UI thread from blocking.

    The important bits of code:

    void LaunchWizardForm(s)
    {
      // Show the wizard on its own thread.
      ThreadStart t = () =>
      {
        _wizard = new WizardForm(s);
        Application.Run(new ApplicationContext(_wizard));
      };
      var thread = new Thread(t);
      thread.SetApartmentState(ApartmentState.STA);
      thread.Start();
    
      // Block this (main UI) thread
      _hiddenForm.ShowDialog();
    }
    
    void EndModalEpisode()
    {
        _hiddenForm.Invoke((Action) (() => _hiddenForm.Hide()));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • 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
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

I want to use ASP.NET and IIS to download dynamically generated files to the
I have a SQL file added to my VS.NET 2008 project as an embedded
I'm not sure if the question title is the best one but it was
Let me start off with a bit of background. This morning one of our

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.