I keep having issues with disposing of UserControl objects
I my application I allow users to click a "CleanUp" button which should lead to a complete dismissal of a UserControl from the screen as well as completely distorting it.
What seem to be happening is that the UserControl disappears from the screen, but remain undistorted, which manifests itself in unexpected "additional" call to certain methods within that UserControl.
The name of my UserControl is PatientInformationBasic.
The name of the Parent form that hosts this control is MainForm.
When the user click on the "CleanUp" button on the MainForm the following code is triggered:
public void cleanUpPid()
PatientInformationDetails pid = this.Controls["pid"] as PatientInformationDetails;
If this is done a few times before a "save" method is called on PatientInformationBasic UserControl this "save" method will be called as many "extra" times as the "CleanUp" button was used, which leads me to believe that the UserControl was not really distorted.
If the code block above is not a proper way to destry a UserControl, what is the proper way?