?
Solved

Close form problem

Posted on 2011-10-25
3
Medium Priority
?
332 Views
Last Modified: 2013-12-16
Hallo,

I am creating a "ClassLibrary" project in C#. I am using VS 2008. My dll is calling from AutoCad for creation of some AutoCad entities. Now,

In my dll two forms are there.

Form A
Form B

From Form A, Form B is opening. I am using the following lines to open the Form B

Form B.Show(this);

I am actually hiding the Form B at close event by using the following lines

       private void frmAssignMilestone_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }

Now When I am trying to close Form A after closing of Form B using the following line

this.close

The Form A is not closing. This is the problem. Please Help

Thanx
0
Comment
Question by:Amitava_Mukherjee
3 Comments
 
LVL 2

Expert Comment

by:jimmycdinata
ID: 37022773
Can I see the complete code?
0
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 37022806
private void frmAssignMilestone_FormClosing(object sender, FormClosingEventArgs e)
        {
if(bHideInsteadOfClose)
{
            this.Hide();
            e.Cancel = true;
}
        }

where bHideInsteadOfClose is a public boolean variable you create as a member of form B.  Normal usage is you set it to true BUT when you want to close the form A then you set it to false.
0
 

Author Closing Comment

by:Amitava_Mukherjee
ID: 37022846
THanx, it works
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

579 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