Form controls

  • Thread starter Thread starter Davis
  • Start date Start date
D

Davis

Hi, Simple question does disposing a form dispose of its controls
aswell. I have seen some contradicting posts on this in the archives, Can
someone
give a definite answer.

Thanks
 
Yes but only managed code. You have to implement a destructor (or implement
IDisposable) for unmanaged code.

Regards
Simon.
 
In CF 1.0, calling MyForm.Dispose() definitely does NOT call Dispose()
on it's constituant controls. CF 2.0 does.

To get around this in 1.0, in the form's Dispose() method, you can loop
through the controls collection and explicitly call Dispose() on each
control.
 
Many thanks for the explanations

In CF 1.0, calling MyForm.Dispose() definitely does NOT call Dispose()
on it's constituant controls. CF 2.0 does.

To get around this in 1.0, in the form's Dispose() method, you can loop
through the controls collection and explicitly call Dispose() on each
control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top