Several years ago I created this class to assist with making a better, more useful Message Box windows in Add-ins and other projects. You can find it here in my GitHub repository:
There were a few times I wanted to show the user a message, but also provide them with a link. Other times I found that I needed to present an error to the user, but wanted to hide more “technical” details from them, unless they clicked a More Info button. I also found cases where I needed to present an error if the user wanted to stop a potentially unattended process, but also wanted the message to dismiss after a period of time so the process could continue. Other times I wanted to present the user with a useful message, but an option to “Do not show this message again.”
After creating custom forms, over and over again, this C# library was born. I recently was writing a VSTO add-in that needed the later option – do not show again – and dusted off this old library, cleaned it up a bit (not not completely) and used it again. I figured, for posterity, I would share this with everyone since I have found it so useful over the years.
For the most part you use this exactly like you would the regular MessageBox object, with some extra goodies included.
For example, this will create a very simple Message box that will look fmailiar:
A more common scenario you might need with a checkbox, looks like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|ExtendedDialogResult LobjResult = ExtendedMessageBox.Show("Hello World – Are you ok?",|
|"The Office Context",|
|"Do not show this message again.");|
|if(LobjResult.Result == DialogResult.OK && LobjResult.IsChecked)|
|// do something|
There are a lot more options and capabilities. I will not cover them all here, but they will be detailed in the README in the GitHub repository.
Please let me know if you have any questions or issues.
2 thoughts on “Extended MessageBox Library”
Great library, any plans to add it to nuget?
I have never really considered it, nor have I pushed anything to nuget before either. I will have to research it.