Support Forums

Full Version: Secrets Behind The Message Box (What The Heck!??!)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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:

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.
Really basic and obvious stuff but you have went into a lot of detail which will be really helpful for beginners. All I would really say though is MessageBox.Show is a better way rather than MsgBox.

Good stuff anyway.
Yap like stated above youve gone into very depths to explain it very well so you deserve a thank you for it and for the time you spent on it
LMAO

Good start at SF, I guess.
(09-26-2010, 08:05 AM)Fragma Wrote: [ -> ]Really basic and obvious stuff but you have went into a lot of detail which will be really helpful for beginners. All I would really say though is MessageBox.Show is a better way rather than MsgBox.

Good stuff anyway.

ha thanks people lol... Ill post some more stuff on SF bout VB, i'm crazy about that stuff.

About that MessageBox.Show, there are a few reasons why not to use it, takes up a few bytes worth of line & code, more harder to use when you want to do something like this:
Code:
MessageBox.Show("Completed, added and replaced with: " + MegabytesBox.Text + " Megabytes Successfully", 64, "Megabytes Added and Replaced")
Simple, but I give you props for the time writing this.
(09-26-2010, 11:13 AM)L3g1tWa5te Wrote: [ -> ]ha thanks people lol... Ill post some more stuff on SF bout VB, i'm crazy about that stuff.

About that MessageBox.Show, there are a few reasons why not to use it, takes up a few bytes worth of line & code, more harder to use when you want to do something like this:
Code:
MessageBox.Show("Completed, added and replaced with: " + MegabytesBox.Text + " Megabytes Successfully", 64, "Megabytes Added and Replaced")

Writing that out makes less lazy programmers, I know lots of them already. Proves my point here that there's multiple ways of coding that people prefer, don't call them wrong methods.

In Fragmas case, a few bytes won't do anything in terms of byte size, and it won't affect the performance of the built program in the end.
very helpful thanks
(03-31-2011, 07:40 PM)Infinity Wrote: [ -> ]Writing that out makes less lazy programmers, I know lots of them already. Proves my point here that there's multiple ways of coding that people prefer, don't call them wrong methods.

In Fragmas case, a few bytes won't do anything in terms of byte size, and it won't affect the performance of the built program in the end.

You never know -- for sure.
Well if you didn't upload to Tinypic,we could have read this.
Pages: 1 2