Solved

c# vs2008 winforms minimizing

Posted on 2012-12-21
2
292 Views
Last Modified: 2012-12-21
Hello.  Suddenly I am having an issue with a couple of c#, vs2008 applicaitons recently written.  Form_1 double-click in the first case, and a context menu item click in the second case, cause new forms to pop up (showdialog)-- one to enter information which has its own save button and exit button, and one to conduct a search.  

In both cases, I use the Hide method to "close" the form (from the user's viewpoint), and then the close method in the calling program to close those pop up forms.

For example:
        private void Form1_DoubleClick(object sender, EventArgs e)
        {
            frmNotes f = new frmNotes();
            f.ConnString = this._ConnString;
            f.ShowDialog();
            f.Close();
        }


Intermittenly, then, the calling program minimizes after showing and closing these pop up forms.

What could be causing that?
0
Comment
Question by:g_johnson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 38713948
Not sure what's causing the minimizing issue, but...

Instead of Hide() to close the dialog, actually set DialogResult() to dismiss it.  You also don't need to Close() the dialog since it has already been dismissed.  That dialog will automatically be disposed of since it goes out of scope when the method exits.
0
 
LVL 4

Author Closing Comment

by:g_johnson
ID: 38714729
Thanks for the tip.  I'm not sure how it solved the issue, but early indications are that it did.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question