a guest Jul 17th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void OpenForm<TForm>() where TForm : Form, new()
  2. {
  3.     var form = Application.OpenForms.OfType<TForm>().FirstOrDefault();
  4.     if (form != null)
  5.         form.BringToFront();
  6.     else
  7.         new TForm {MdiParent = this}.Show();
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand