Post[Tutorial]MsgBox Fundamentals

Posts 1–13 of 13 · Page 1 of 1
[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

Code:
MsgBox ("Your Message Here")
Or the one that is least known and least used

Code:
Interaction.MsgBox("Your Message Here")
Note: Both Work in the same capacity.

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")
MsgBox and VbYes

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
Return a Value from msgbox

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
Icons

You will notice in alot of these examples I am using the code

Code:
Microsoft.VisualBasic.MsgBoxStyle.Exclamation
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 displa
y

Exclamation



Code:
Microsoft.VisualBasic.MsgBoxStyle.Exclamation
Information Icon



Code:
Microsoft.VisualBasic.MsgBoxStyle******rmation

Critical Error



Code:
MsgBoxStyle.OkCancel + MsgBoxStyle.Critical
Question



Code:
MsgBoxStyle.OkCancel + MsgBoxStyle.Question
Hope this helps.
thanks for posting this tutorial might help some newbs =P
I received 3 PM(s) At-least regarding message box's and there has been 1 maybe 2 posts thats 4-5 times... Figured , it needed to be done
Easy to understand! Good job as always
Grattz on 1300posts
Good work!
Requests for tutorials on messageboxes? What the f* do these kids get in school o__O
Quote Originally Posted by Retoxified View Post
Requests for tutorials on messageboxes? What the f* do these kids get in school o__O
Most kids "learning" vb only learn it because they can't comprehend C++.

Anyways, good tut.
I usually use this method

Code:
MessageBox.Show("Message", "Ttile", MessageBoxButtons., MessageBoxIcon.)
Quote Originally Posted by poneboy00 View Post
I usually use this method

Code:
MessageBox.Show("Message", "Ttile", MessageBoxButtons., MessageBoxIcon.)
Good to know..............

THANKSSSSSSSSSSSSSSSSSS!
Nice tutorial NextGen1!

Hmmmm... Don't mean to Hijack your thread, but lately I've been seeing that Critical Error Icon a lot. lol :P
Quote Originally Posted by why06 View Post
Nice tutorial NextGen1!

Hmmmm... Don't mean to Hijack your thread, but lately I've been seeing that Critical Error Icon a lot. lol :P
Maybe it's a sign from your computer that something is going to happen
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?