BalajiKasiraj
BalajiKasiraj

Reputation: 1

Message Box hidden in task bar in win form

I have a win form containing only progress bar and logic for opening and closing an excel or word document using interopt dll. This win form runs when I click a button in my web application. The problem is, the win form after closing document displays a Message Box. This message box always remains in the taskbar instead of Showing up in the screen.

PS:

DialogResult Result = MessageBox.Show("Save","Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

When I give the message box in this format, the message box always remains in the taskbar. But the functionalities given as properties for the message box works fine.

DialogResult Result = MessageBox.Show("Save","Confirm", MessageBoxButtons.YesNoCancel,MessageBoxOptions.DefaultDesktopOnly, MessageBoxIcon.Question);

When I give the message box in this format, the message box does not remains in the taskbar but the variable "Result" always returns "No".

Thanks in Advance

Upvotes: 0

Views: 649

Answers (1)

Ramya Khandel
Ramya Khandel

Reputation: 11

Try the below:

DialogResult Secondpopups = MessageBox.Show(new Form() { TopMost = true },"Message u need to diaplay", "Title of the Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

Upvotes: 1

Related Questions