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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:11:54+00:00 2026-05-27T11:11:54+00:00

In this WinForms project, I have a certain information form ( InfoForm ) which

  • 0

In this WinForms project, I have a certain information form (InfoForm) which pops up for 2 seconds, then disappears. The way I do this is by calling

infoForm.Show();

and then inside InfoForm I have a Timer that ticks after 2 seconds and calls Close().

Now, sometimes there’s another form ErrorForm I need to show modally (using errorForm.ShowDialog()), to inform the user that an error has occurred, and they need to click OK before they can continue. This can happen while the InfoForm is opening and closing, and the one should not affect the other.

But it does.

I have gone so far as to put a breakpoint on the call to ShowDialog, and if the InfoForm is open at the time that I hit the breakpoint, then when I click ‘Step Over’, instead of popping up the ErrorForm and waiting for me to click "OK", the debugger just steps over the line and is already on the next line, as if the form never opened. Meanwhile in the background the InfoForm has closed, so if I reset the execution point to the call to ErrorForm.ShowDialog(), and then "Step Over", the form appears, as expected, and waits for me to click "OK" before moving to the next statement.

Removing breakpoints and writing to a debug log confirms my suspicion that it’s the closing of the InfoForm that is causing my ErrorForm to be untimely closed:

Thread 09 – 2011/12/14 16:39:30.574 – Info form shown

Thread 09 – 2011/12/14 16:39:31.300 – Before ErrorForm.ShowDialog

Thread 09 – 2011/12/14 16:39:32.584 – Timer Tick

Thread 09 – 2011/12/14 16:39:32.585 – Info form closing

Thread 09 – 2011/12/14 16:39:32.593 – Error form closing

Thread 09 – 2011/12/14 16:39:32.593 – After ErrorForm.ShowDialog

Why is this happening, and what is the cure?

  • 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-27T11:11:54+00:00Added an answer on May 27, 2026 at 11:11 am

    You should pass the MainForm as owner to ErrorForm.ShowDialog().

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

Sidebar

Related Questions

I am working on a winforms project and i have this following code in
I have a VS 2008 WinForms project, and I recently added an existing form
I have a winforms project which allows future developers to create plugins for the
Im doing a project with C# winforms. This project is composed by: alt text
I have some code like this in a winforms app I was writing to
This is a subjective question, but I need opinions. I have a WinForms C#
I have an existing C# 3.0 WinForms project with .NET 3.5 that talks to
I have been looking at Prism to host an old Winforms application. This is
I trying to port a WinForms project to WPF. But I am have some
I am working in a C# winforms project and I have a user control

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.