Solved

c# vs2008 winforms minimizing

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

18 Experts available now in Live!

Get 1:1 Help Now