[Tutorial]MsgBox Fundamentals
[Tutorial] MsgBox Fundementals In Vb.net
On more then a few occasions questions have been raised in regards to MsgBox's , So, I fugure a MessageBox Tutorial is in order.
Code Snippets
Create a Standard MessageBox
Or the one that is least known and least used
Note: Both Work in the same capacity.
VB Abort, Retry , Cancel With Title
MsgBox and VbYes
Return a Value from msgbox
Icons
You will notice in alot of these examples I am using the code
This allows you to display the Microsoft message box icon/Style you would like to display
Here is the list of icons and style of MsgBox to display
Exclamation

Information Icon

Critical Error

Question

Hope this helps.
On more then a few occasions questions have been raised in regards to MsgBox's , So, I fugure a MessageBox Tutorial is in order.
Code Snippets
Create a Standard MessageBox
Code:
MsgBox ("Your Message Here")
Code:
Interaction.MsgBox("Your Message Here")
VB Abort, Retry , Cancel With Title
Code:
MsgBox("This is a messagebox with Abort, Retry Cancel, and You can set the Title of the messagebox", MsgBoxStyle.AbortRetryIgnore, "Title")
Code:
Dim exitout As String
exitout = MsgBox("Would You Like To Exit?", Microsoft.VisualBasic.MsgBoxStyle.Exclamation + Microsoft.VisualBasic.MsgBoxStyle.YesNo + Microsoft.VisualBasic.MsgBoxStyle.MsgBoxHelp, "Title")
If exitout = vbYes Then
End
End If
Code:
Dim ReturnV As Integer
ReturnV = MsgBox("This is a message box!",MsgBoxStyle.OKCancel + MsgBoxStyle******rmation + MsgBoxStyle.SystemModal, "Message Box")
If (ReturnV = MsgBoxResult.OK) Then
Label1.Text("OK button Has Been Clicked")
'Or use a messagebox, or a textbox or a listbox etc. etc. etc .
End If
You will notice in alot of these examples I am using the code
Code:
Microsoft.VisualBasic.MsgBoxStyle.Exclamation
Here is the list of icons and style of MsgBox to display
Exclamation

Code:
Microsoft.VisualBasic.MsgBoxStyle.Exclamation
Code:
Microsoft.VisualBasic.MsgBoxStyle******rmation
Critical Error
Code:
MsgBoxStyle.OkCancel + MsgBoxStyle.Critical
Code:
MsgBoxStyle.OkCancel + MsgBoxStyle.Question



