09-25-2010, 10:20 PM
(This post was last modified: 04-01-2011, 11:24 AM by Resistance.)
I bet you never knew this but VB MsgBoxes have many secrets that you probably never knew about... Here are a Few.
Number Codes (How The?) !!:
Check Out This List( I Memorized a Few important ones I use alot, saves a lot of time from scrolling and finding the right one to use.):
Example:
MsgBox("Message/Body Text Here" , One Of Those Number Codes I Gave You, "Title Of Message Box Here")
0 = No Style Message Boxes - OK
1 = No Style Message Boxes - OK, Cancel
2 = No Style Message Boxes - Abort, Retry, Ignore
3 = No Style Message Boxes - Yes, No, Cancel
4 = No Style Message Boxes - Yes, No
5 = No Style Message Boxes - Retry, Cancel
Skiping 6-15
16 = Error MsgBox - OK, (My Favorite)
17 = Error MsgBox - OK, Cancel
18 = Error MsgBox - Abort, Retry, Ignore
19 = Error MsgBox - Yes, No, Cancel
20 = Error MsgBox - Yes, No
Skipping 21-31,
32 = Question MsgBox - OK,
33 = Question MsgBox - OK, Cancel
34 = Question MsgBox - Abort, Retry, Ignore
35 = Question MsgBox - Yes, No, Cancel
36 = Question MsgBox - Yes, No
Skipping 38-47,
48 = Warning/Exclamation - OK
49 = Warning/Exclamation - OK, Cancel
50 = Warning/Exclamation - Abort, Retry, Ignore
51 = Warning/Exclamation - Yes, No, Cancel
52 = Warning/Exclamation - Yes, No
53 = Warning/Exclamation - Retry, Cancel
Skipping 54-63,
64 = Information MsgBox - OK
65 = Information MsgBox - OK, Cancel
66 = Information MsgBox - Abort, Retry, Ignore
67 = Information MsgBox - Yes, No, Cancel
68 = Information MsgBox - Yes, No
69 = Information MsgBox - Retry, Cancel
Next About MessageBoxes, MsgBox "Traps". Usually used for important decisions, where you must choose an option and cannot close the Message Box.
See The "X"/Close Button is Disabled. Now The Code For This Is:
Oh Also when you get to: "= MsgBoxResult.Yes)" You can edit the "Yes" To other results such as "No", "Cancel" and "Retry".
If I find more stuff Ill share it with you guys.... Enjoy!!! I found this very helpful.
Number Codes (How The?) !!:
Check Out This List( I Memorized a Few important ones I use alot, saves a lot of time from scrolling and finding the right one to use.):
Example:
MsgBox("Message/Body Text Here" , One Of Those Number Codes I Gave You, "Title Of Message Box Here")
0 = No Style Message Boxes - OK
1 = No Style Message Boxes - OK, Cancel
2 = No Style Message Boxes - Abort, Retry, Ignore
3 = No Style Message Boxes - Yes, No, Cancel
4 = No Style Message Boxes - Yes, No
5 = No Style Message Boxes - Retry, Cancel
Skiping 6-15
16 = Error MsgBox - OK, (My Favorite)
17 = Error MsgBox - OK, Cancel
18 = Error MsgBox - Abort, Retry, Ignore
19 = Error MsgBox - Yes, No, Cancel
20 = Error MsgBox - Yes, No
Skipping 21-31,
32 = Question MsgBox - OK,
33 = Question MsgBox - OK, Cancel
34 = Question MsgBox - Abort, Retry, Ignore
35 = Question MsgBox - Yes, No, Cancel
36 = Question MsgBox - Yes, No
Skipping 38-47,
48 = Warning/Exclamation - OK
49 = Warning/Exclamation - OK, Cancel
50 = Warning/Exclamation - Abort, Retry, Ignore
51 = Warning/Exclamation - Yes, No, Cancel
52 = Warning/Exclamation - Yes, No
53 = Warning/Exclamation - Retry, Cancel
Skipping 54-63,
64 = Information MsgBox - OK
65 = Information MsgBox - OK, Cancel
66 = Information MsgBox - Abort, Retry, Ignore
67 = Information MsgBox - Yes, No, Cancel
68 = Information MsgBox - Yes, No
69 = Information MsgBox - Retry, Cancel
Next About MessageBoxes, MsgBox "Traps". Usually used for important decisions, where you must choose an option and cannot close the Message Box.
See The "X"/Close Button is Disabled. Now The Code For This Is:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Interaction.MsgBox("Do You Wish To Delete This File?", 36, "Double Check") = MsgBoxResult.Yes) Then
MsgBox("Deleted")
Else
MsgBox("Operation Canceled")
End If
End Sub
End Class
Oh Also when you get to: "= MsgBoxResult.Yes)" You can edit the "Yes" To other results such as "No", "Cancel" and "Retry".
If I find more stuff Ill share it with you guys.... Enjoy!!! I found this very helpful.