I have two forms and I set one of the forms\' TopMost
property to true. Somewhere, while the program runs, I show a MessageBox, but since TopMost is set to true
To show a MessageBox
on top of all the other forms of your application (including those with TopMost
set) you can use the Show() method overload that takes a parameter of type MessageBoxOptions and pass MessageBoxOptions.ServiceNotification as that parameter.
DialogResult result = MessageBox.Show("Configuration file was corrupted.\n\nDo you want to reset it to default and lose all configurations?", "Config File Corrupted", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.ServiceNotification);