Solved

c# vs2008 winforms minimizing

Posted on 2012-12-21
2
283 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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