Solved

c# vs2008 winforms minimizing

Posted on 2012-12-21
2
280 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
2 Comments
 
LVL 85

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now