Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Secrets Behind The Message Box (What The Heck!??!)
#1
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.
[Image: t5BWm.png]
Reply
#2
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.
Reply
#3
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
[Image: banner.gif]
Reply
#4
LMAO

Good start at SF, I guess.
Member Count:1,585
Post Count:48,383
Thread Count:9,626
RF is an off-topic, general chat forum where anything goes.
Complete these requirements and be 1st VIP member {click me}
Reply
#5
(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")
[Image: t5BWm.png]
Reply
#6
Simple, but I give you props for the time writing this.
Reply
#7
(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.
Reply
#8
very helpful thanks
Reply
#9
(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.
[Image: t5BWm.png]
Reply
#10
Well if you didn't upload to Tinypic,we could have read this.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  VB6 Message Box Tutorial BreShiE 3 880 12-08-2011, 09:19 AM
Last Post: BreShiE
  [TuT] VB6 Message Box Spammer [TuT] HakkuR* 30 6,140 06-06-2011, 04:43 PM
Last Post: Black Demon
  [Preview] Unicode Stegonography (encrypt message in plain sight) [UPDATED] KoBE 6 2,363 12-22-2010, 12:28 PM
Last Post: KoBE

Forum Jump:


Users browsing this thread: 1 Guest(s)