Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

closing winform

Posted on 2009-03-30
6
Medium Priority
?
425 Views
Last Modified: 2013-12-17
Can open a 2nd WinForm via the 1st main WinForm.

Created an association (ownership) between the 1st and newly opened 2nd WinForm

The scripting also checks to see if the WinForm has been opened already ... this works (appears too).

Issue is:  when closing the 2nd WinForm and then wanting to open it again I call the opening WinForm script again -- but I cannot reopen the WinForm (once closed) -- I suspect it has something to with the formBrowser  null  status.

How do I reset this parameter or get working correctly?
// WinForm #1
 
FormBrowser formBrowser;
 
 
if (formBrowser != null) return;
 
formBrowser = new FormBrowser { Owner = this };
formBrowser.Show();

Open in new window

0
Comment
Question by:amillyard
6 Comments
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 24018064
Have you put in a breakpoint to see if formBrowser is null?  
0
 

Author Comment

by:amillyard
ID: 24018331
angus_young_acdc:  checking the breakpoint ... null the 1st time called.  the 2nd onwards is not displayed as null, but is soft of empty !   when disposing the WinForm, it is not resetting back to null status
0
 
LVL 9

Expert Comment

by:VikramMullick
ID: 24018551
try
formBrowser.Showdialog(this)
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 800 total points
ID: 24018561
you should check for null or IsDisposed
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1200 total points
ID: 24018587
It won't. Closing the form will not nullify the variable that was pointing to it.

You are best to check for null, or if the form is Disposed:
        private void button1_Click(object sender, EventArgs e)
        {
            if (f == null || f.IsDisposed)
                f = new Form5();
 
            f.Show();
        }
 
        Form5 f = null;

Open in new window

0
 

Author Closing Comment

by:amillyard
ID: 31564285
carl_tawn: & emoreau:  works great now :-)   many thanks.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month11 days, 21 hours left to enroll

916 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