Jump to content
xisto Community
Sign in to follow this  
xplorer-ex

Simple Message Box

Recommended Posts

hi all, heres a simple tutorial on how to make a message box in VB

start a new form in visual basic,

draw a command button which should contain the text "Command1" when drawn,

double click on the button, and write the code

msgbox "Hello World", vbcritical, "Xplorer_3X Says..."

so your code should look like this;

Private Sub Command1_Click()msgbox "Hello World", vbcritical, "Xplorer_3X Says..."end sub

Now compile the project and click on the button, and Wa-laa, there she be.

Share this post


Link to post
Share on other sites

HMM although myVB currently cannot be installed ( due to HDD and server problems) This seems godBut not that effective good for newbies Whi just bought VB but for me it is too simple but wil try ti out

Share this post


Link to post
Share on other sites

I'm not sure about the use of "vbcritical" as I've never seen that before while using Visual Basic =/ Simply

Msgbox('Enter Text')

would do the job assuming you're using the .NET version of VB.

Share this post


Link to post
Share on other sites

I'm not sure about the use of "vbcritical" as I've never seen that before while using Visual Basic =/ Simply

 

Msgbox('Enter Text')

would do the job assuming you're using the .NET version of VB.

MsgBox(prompt[, buttons] [, title] [, helpfile, context])

Buttons argument; can be combined using butwise operator OR:

 

This is the list of available constants that determine which buttons will appear on the message box:

0 - vbOKOnly - OK button only.

1 - vbOKCancel - OK and Cancel buttons.

2 - vbAbortRetryIgnore - Abort, Retry, and Ignore buttons.

3 - vbYesNoCancel - Yes, No, and Cancel buttons.

4 - vbYesNo - Yes and No buttons.

5 - vbRetryCancel - Retry and Cancel buttons.

This is the list of available constants that determine which images will appear on the message box:

16 - vbCritical - Critical Message icon.

32 - vbQuestion - Warning Query icon.

48 - vbExclamation -Warning Message icon.

64 - vbInformation - Information Message icon.

There are some more constants, determinig behaviour of the buttons, or the message box itself, but they can be found in the Visual Basic help...

 

MsgBox can also be used as a function, where it returns different values, for different buttons that are pressed:

1 - vbOK - OK

2 - vbCancel - Cancel

3 - vbAbort - Abort

4 - vbRetry - Retry

5 - vbIgnore - Ignore

6 - vbYes - Yes

7 - vbNo - No


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.