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();
}
If you want a modal dialog, use
Otherwise, for a normal form shown at the same time as FormA… you may not even have to. See this post.: