How can I make sure that when I click on the ToolStripMenuItem, only one form opens? [closed]

  Kiến thức lập trình

There are several ToolStripMenuItem elements that open different forms when clicked. The problem is that if I click N times on one of the ToolStripMenuItem elements, then after closing the new form it will open several more times (N-1). How can I fix this if I use Form.ShowDialog()?

I found a solution where I need to check if there is a form in the collection of open forms so that no duplicates are created. But it’s the usage that I need Form.ShowDialog().

New contributor

Елизавета Левина is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT