I'd like to have two forms accessible at the same time, meaning that I can click on the main form without closing the second form.
Here's how I'm currently doing for example to show a form after a right click but I get an exception:
// In main form
private void contextMenuStrip1_Click(object sender, EventArgs e)
{
RightClickMenu.GetInstance().Show(); // works but exception System.ObjectDisposedException (HResult=0x80131622) if I try to open it a second time after RightClickMenu : Form
// RightClickMenu.GetInstance().ShowDialog(); // can't have both forms accessible at the same time
}
// In second form
public partial class RightClickMenu : Form
{
public static RightClickMenu GetInstance()
{
if (_RightClickMenu == null)
{
_RightClickMenu = new RightClickMenu();
}
return _RightClickMenu;
}
public RightClickMenu()
{
InitializeComponent();
}
private void buttonQuit_Click(object sender, EventArgs e)
{
this.Close();
}
}
Thanks
User contributions licensed under CC BY-SA 3.0