I’m a great fan of Devcomponents DotNetBar (https://www.devcomponents.com/dotnetbar/). Their collection of Windows forms controls are plentiful and don’t require you to take out a second mortgage to afford them. Being an indie developer; working on personal projects as a hobby, many similar toolkits are simply too expensive.

However, I was a little disappointed with the customisation capabilities of their replacement ‘messageboxex’ component. Their ‘task dialog’ component can fill in several of the gaps but I needed more functionality with that too. So I have developed a replacement user control which can be dropped into any new projects.

In keeping with the Windows look and feel, I think it looks great when styled with DotNetBar. All the themes are available of course but not shown here.

More usefully, you can also specify any user control to appear in the message box and it will retain the look and feel of the base MessageBox (‘More Details’, web hyper-link, etc.)

Constructors

It has 8 constructors as follows:

SIMPLE – MsgBox with icon, prompt, message
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton)

SIMPLE MsgBox with icon, prompt, message, linklabel
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton, ByVal s_LinkLabel As String)

DETAILED MsgBox with icon, prompt, message, details
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal s_MsgDetails As String, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton)

DETAILED MsgBox with icon, prompt, message, details, linklabel
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal s_MsgDetails As String, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton, ByVal s_LinkLabel As String)

COMPONENT MsgBox with icon, prompt, message, embedded component
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal Component As UserControl, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton)

COMPONENT MsgBox with icon, prompt, message, embedded component, linklabel
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal Component As UserControl, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton, ByVal s_LinkLabel As String)

EXTENDED COMPONENT MsgBox with icon, prompt, message, details, embedded component
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal s_MsgDetails As String, ByVal Component As UserControl, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton)

EXTENDED COMPONENT + LINKLABEL MsgBox with icon, prompt, message, details, embedded component, linklabel
Public Function ShowAdvMsg(ByVal i_MsgImage As ShowMsgImage, ByVal s_MsgPrompt As String, ByVal s_Message As String, ByVal s_MsgDetails As String, ByVal Component As UserControl, ByVal Buttons As ShowMsgButtons, ByVal DefaultButton As ShowMsgDefaultButton, ByVal s_LinkLabel As String)

The linklabel on the messagebox is supplied as a “|” delimitted string such as “Hello World!|https://www.johnfermor.com”

 

Usage Examples

ShowAdvMsg(ShowMsgImage.Info,
“These files might be harmful to your computer”,
ShowMsgButtons.OkOnly,
ShowMsgDefaultButton.Button1)

ShowAdvMsg(ShowMsgImage.Alert,
“These files might be harmful to your computer”,
“Your Internet security settings suggest that one or more files may be harmful. Do you want to use it anyway?”,
“Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lacinia vestibulum urna vitae semper. Quisque ornare leo faucibus erat iaculis scelerisque. Phasellus sed lorem felis. In fringilla, augue vel tempor feugiat, dolor nisl faucibus magna.”,
New UserControl1,
ShowMsgButtons.OkCancel,
ShowMsgDefaultButton.Button1, “How do I decide whether to unblock these files?|www.johnfermor.co.uk”)

 

New Component