Let's suppose I have 2 forms: FormA
and FormB
. On FormA
button click the instance of FormB
is created and shown.
How to Dispose()
FormB
instance correctly after it has been closed?
To be more precise, let's suppose this is the code that creates a form:
public void Settings(object sender, EventArgs e)
{
if (_settings == null)
_settings = new Settings(_repositoryCollection, _config, this);
_settings.Show();
_settings.Focus();
}