SampleForm form1;
private void OpenForm()
{
form1 = new SampleForm();
form1.Show(); // Show form modelessly.
}
private void ForceShutdown()
{
// Completely close the form if it is still running.
// Note that hiding the form might not work by itself.
if (form1 != null)
{
form1.Close();
form1.Dispose();
form1 = null;
}
object saveChanges = Word.WdSaveOptions.wdSaveChanges;
this.Close(ref saveChanges, ref missing, ref missing);
}