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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:09:28+00:00 2026-05-23T03:09:28+00:00

I have 2 Windows in my sample App (learning .Net 4 WPF) In the

  • 0

I have 2 Windows in my sample App (learning .Net 4 WPF)

In the first window, I have a timer and when 5 seconds passed, i want to close the current Window and open a new Window.

The problem I’m running into is closing the first window

Here’s some sample code

MainWindow m = new MainWindow();
m.ShowDialog();
this.Hide();

this.Hide never actually hides the current window. I end up with 2 windows on my screen instead of 1.

  • 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-23T03:09:29+00:00Added an answer on May 23, 2026 at 3:09 am

    In the remarks of ShowDialog it says When this method is called, the code following it is not executed until after the dialog box is closed.

    So, you can just swap the order of ShowDialog and Hide. and you have to use ‘Show’ or ‘Close’ after ‘ShowDialog’ to either display back first form or close it.

    Also, note that closing a form (what you said want to do) is different to hiding a form (what you’re currently doing).

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

Sidebar

Related Questions

I have a simple .NET 2.0 windows form app that runs off of a
I have Windows Vista MCML app, and I need to figure out the current
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I'm learning to develop apps using Qt Creator. I have built a simple app
I have a sample windows phone 7 project where I test some MVVM stuff,
I have an Windows Forms application VS 2008 - C#, that uses app.config. In
I hope this makes sense. I have a Windows Phone 7 app that is
In my app I have several pages. When I click on the Windows Back
I have a simple HTML (as HTA) application that shows strange behavior on Windows
I have a binary file - Windows static library (*.lib). Is there a simple

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.