According to MSDN:

Control.Disposing Property Gets a value indicating whether the base Control class is in the process of disposing.

But when I checked, Disposing property of the control is always false (inside the Dispose() method itself).

When will this Disposing property become true?

Recommended Answers

All 2 Replies

Just because your parent is disposing, doesn't mean your child control is currently disposing. It could happen later, it could have already happened. In most cases a Dispose runs that quickly that you will never pick up the "true" flag.

The other possibility is that you have a memory leak and the control is never disposed of. The Garbage Collector might come and get it at some point, but best to be sure.

Yes. I got it.
It will be true in the disposing event of base control. I have checked the MSDN implementation. In Dispose() method of Control class, the property is set as true in disposing code block and it is reset to false after disposed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.