Disable close button in MessageBox.Show

Posted on 2009-05-24
Medium Priority
Last Modified: 2013-12-17
How can I disable the close button (the [x] button on top right corner) in MessageBox.Show?
I've checked through MSDN help on it, there is no overloaded method that does that, it seems. But I just want to be sure. Any idea for workaround?
Question by:philipjonathan
LVL 96

Accepted Solution

Bob Learned earned 400 total points
ID: 24463968
Not possible, as far as I know...
LVL 30

Expert Comment

ID: 24463977
You may write your own "messagebox" - pretty simple
LVL 30

Assisted Solution

anarki_jimbel earned 400 total points
ID: 24463985
You may also try:


see the "Disabling the Close button" section
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

LVL 11

Assisted Solution

anyoneis earned 400 total points
ID: 24464118
Actually, try specifying a set of buttons that does not include "Cancel", as in:
       private void button1_Click(object sender, EventArgs e)
            MessageBox.Show("Does the emperor have close?", "The Emperor",
In VS 2008, at least (.NET 3.5 SP1) the "x" is disabled.
LVL 18

Author Comment

ID: 24464548
Thanks all for the input! I'll accept anarki for the link to interesting article.
LVL 18

Author Comment

ID: 24464552
Oops, I'm sorry I clicked the wrong link, and accepted the learned one's comment instead. I hope none of you mind, otherwise I'll try to raise a request to mods

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
If you are looking for an automated tool which can generate reports for Outlook emails and other items from PST file, then you can go for Kernel PST Reporter tool. The reports which are created by this tool are helpful to analyze and understand PST …

619 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question