A Million Little Pieces Of My Mind

NamtiraLib

SuperMessages

By: Paul S Cilwa Posted: 4/10/2026 Page Views: 25
Hashtags: #Namtira #VisualBasic #VBNET #ClassLibrary #NamtiraLib #SuperMessages #MessageBox #InputBox
Simplified wrappers around the standard MessageBox and InputBox dialogs.
Estimated reading time: 2 minute(s) (288 words)

WinForms provides MessageBox.Show for dialogs, but calling it with the right combination of buttons, icons, and default-button constants is verbose and easy to get wrong. SuperMessages wraps the three most common patterns—a yes/no question, a simple notification, and a text-input prompt—into short, readable functions with sensible defaults.

Module SuperMessages
MemberParametersExample
AskBoxText As String, Title (opt), IconChoice (opt)If AskBox("Delete?") Then ...
MsgBoxText As String, Title (opt), Buttons (opt), IconChoice (opt)MsgBox("Done!", "Status")
InputBoxText As String, Title (opt), Buttons (opt)Dim name = InputBox("Your name?")

AskBox

Presents a Yes/No dialog and returns True if the user clicks Yes. The default button is No, so pressing Enter without thinking won't accidentally confirm a destructive action. The icon defaults to MessageBoxIcon.Question.

Public Module SuperMessages Public Function AskBox(Text As String, Optional Title As String = "", Optional IconChoice As MessageBoxIcon = MessageBoxIcon.Question) As Boolean Return (MessageBox.Show(Text, Title, MessageBoxButtons.YesNo, IconChoice, MessageBoxDefaultButton.Button2) = DialogResult.Yes) End Function End Module

MsgBox

A fire-and-forget notification. Defaults to an OK button and the Information icon. The optional Buttons and IconChoice parameters let you override these when needed.

Public Sub MsgBox(Text As String, Optional Title As String = "", Optional Buttons As MessageBoxButtons = MessageBoxButtons.OK, Optional IconChoice As MessageBoxIcon = MessageBoxIcon.Information) MessageBox.Show(Text, Title, Buttons, IconChoice) End Sub

InputBox

Prompts the user for a line of text, delegating to the classic Microsoft.VisualBasic.Interaction.InputBox under the hood. Returns the entered string, or an empty string if the user cancels.

Public Function InputBox(Text As String, Optional Title As String = "", Optional Buttons As MessageBoxButtons = MessageBoxButtons.OKCancel) As String Return Microsoft.VisualBasic.Interaction.InputBox(Text, Title) End Function