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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:38:15+00:00 2026-05-13T15:38:15+00:00

When I create a form (window) in PowerShell, I can usually display the form

  • 0

When I create a form (window) in PowerShell, I can usually display the form using .ShowDialog():

$form = New-Object System.Windows.Forms.Form
$form.ShowDialog()

.Visible is set to False before and after .ShowDialog().

But when I do a .Show() nothing is displayed on the screen:

$form.Show()

And .Visible is now set to True (presumably because .Show() made the form officially visible.)

When I now try to .ShowDialog() the form again, I get the following error message:

“Form that is already visible cannot be displayed as a modal dialog box. Set the form’s visible property to false before calling showDialog.”

But when I follow the instructions to .ShowDialog() again

$form.Visible=0
$form.ShowDialog()

the result is that nothing is displayed on the screen and PowerShell hangs and cannot recover (ctrl-c doesn’t seem to work). I assume this is because the form is being displayed modally somewhere where I cannot see it (or tab to it). But why?

The coordinates of the form haven’t changed. So how does the form decide when it is physically visible and when it isn’t?

  • 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-13T15:38:16+00:00Added an answer on May 13, 2026 at 3:38 pm

    Avoid using Show() from PowerShell as it requires a message pump and that isn’t something the PowerShell console provides on the thread that creates your form. ShowDialog() works because the OS does the message pumping during this modal call. Creating the form and calling ShowDialog() works reliably for me.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If anyone's interested, I think I solved this by overriding… May 13, 2026 at 7:38 pm
  • Editorial Team
    Editorial Team added an answer You will have to use a CustomValidator to do this.… May 13, 2026 at 7:38 pm
  • Editorial Team
    Editorial Team added an answer What you'd want to do is either adjust a workflow… May 13, 2026 at 7:38 pm

Related Questions

One-line summary: What is the best practice for unhooking event handlers created in the
I have a form (signup.php) that pops up in a nyroModal window when I
I have been trying to write a small app with its own option windows.
I'm trying to create my own error window for the project I am working
I'm trying to implement code-completion popup window in my project. The window is derived

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.