Search code examples
c#winformsmessagebox

Modify Windows Forms Topmost attribute


I want some of my forms when opened stick to screen and disable the forms behind it, like the MessageBox.Show(); messagebox,so that they alert the user with a beep if the user tries to click the forms behind the prioritized forms. How I can I do that?

Thanks in advance.


Solution

  • You can use ShowDialog instead of Show

    This will open a dialog up as a modal dialog (i.e cannot click others until this dialog and its children are closed)

    e.g form1.ShowDialog();