Close form problem

Posted on 2011-10-25
Last Modified: 2013-12-16

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)
            e.Cancel = true;

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


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

Question by:Amitava_Mukherjee
    LVL 2

    Expert Comment

    Can I see the complete code?
    LVL 43

    Accepted Solution

    private void frmAssignMilestone_FormClosing(object sender, FormClosingEventArgs e)
                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.

    Author Closing Comment

    THanx, it works

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    794 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

    15 Experts available now in Live!

    Get 1:1 Help Now