Msgbox - Here is a simple way and lists of MsgBoxes.

Pages: 1, 2
free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > VB Programming

Msgbox - Here is a simple way and lists of MsgBoxes.

sharpz
QUOTE(dul @ Oct 19 2005, 06:38 PM)
Yes. iT IS GOOD. bUT YOU KNOW, IT IS simple version of WinAPI's mESSAGEBoX function. MessageBox has got more possibilities.
*


the visual basic 6's MsgBox class is a wrapper for the MessageBoxA WinAPI call. I think it fills in something like this:
CODE

MsgBox "Some text", "a title"

and replaces it with:
CODE

MessageBox(NULL, "Some text", "a title", NULL);


the msdn documentation for MessageBoxA says:
QUOTE
int MessageBox(     
    HWND hWnd,
    LPCTSTR lpText,
    LPCTSTR lpCaption,
    UINT uType
);

so, all the MsgBox class does is replace the hWnd (handle) of the window with NULL and if you dont fill in a parameter it will full in NULL while calling the API call.

hope this clears up some questions with the MsgBox class.

 

 

 


Reply

Inspiron
Hmmm... He's talking about the types of Messagebox in VB.NET or VB.
Probably many doesn't understand what the code does...
Let me explain them with screenshots..

Normal Message Boxes
CODE
Windows.Forms.MessageBox.Show("This is a plain messagebox.")

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("This is a plain messagebox." & vbCrLf & "It's got a caption too.", "This is the caption.")

Is shown as user posted image
----------------------------------------------------------------------------------------------

Message Boxes with Different Button Types
CODE
Windows.Forms.MessageBox.Show("It's got Abort, Retry, Cancel buttons.", "", MessageBoxButtons.AbortRetryIgnore)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("It's got OK button.", "", MessageBoxButtons.OK)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("It's got OK, Cancel buttons.", "", MessageBoxButtons.OKCancel)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("It's got Retry, Cancel buttons.", "", MessageBoxButtons.RetryCancel)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("It's got Yes, No buttons.", "", MessageBoxButtons.YesNo)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("It's got Yes, No, Cancel buttons.", "", MessageBoxButtons.YesNoCancel)

Is shown as user posted image
----------------------------------------------------------------------------------------------

Message Boxes with Different Alert Types
CODE
Windows.Forms.MessageBox.Show("An Asterisk type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("An Error type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Error)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("An Exclamation type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("A Hand type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Hand)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("An Information type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Information)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("A None type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.None)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("A Question type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Question)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("A Stop type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Stop)

Is shown as user posted image

CODE
Windows.Forms.MessageBox.Show("A Warning type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning)

Is shown as user posted image

I've created an example on VB.NET 2003.
You can download the program here to view all the types of Messageboxes.
Download: http://www.freeuploader.com/view.php/69424.zip
Source Codes: http://www.freeuploader.com/view.php/69426.zip

 

 

 


Reply

sharpz
yes, the windows.forms.messagebox.show is also a wrapper for the MessageBoxA API call i beleive. it is basically the same as Visual Basic 6.0's MsgBox function, just a slightly different syntax. I never bothered with vb.net because c++ is just still alot better for directly accessing memory... however, if managed code becomes the new standard, i guess i would do .net
btw, MessageBoxButtons.OK and etc. are just constants representing hex code that is defined in some windows header that is included when you compile.

Reply

markcqm
Could we change buttom "YES","NO","CANCEL" to other caption?

Reply

Inspiron
You can change the caption, or the title, of any messagebox. The only thing you cannot change is the text of the buttons in a messagebox.

However if you want to have a customised button text, you can make another form that opens as a dialog, to imitate the effects of a messagebox. This way, not even you can customise the button text of the messagebox, you can also add background pictures, sound effects, colors, and even add a customised icon.

Basically just treat the form as a messagebox and customise it..

Reply

Galahad
Hi

You can do as Inspiron said,make a whole new form,and place controls as you like them.

I was never good in subclassing,but I believe changing button captions can be done using subclassing.I would love to give the example,but as I said,I'm no good with subclassing.As always,I direct people to use the web,Yahoo or Google a bit,and dig out some information that is of interest to you.Because,nothing can stick in peoples minds better,than hard way of finding some info out.Check Planet Source Code (http://www.planet-source-code.com/vb/) for examples on MsgBox usage,maybe there are some of customizing this function.

Cheers

Reply

iGuest
How do I change the text of a msgbox button, because I'm using them to open to different form. For example.

I'll have the message box sayin "What would to like to do next?"
Then ideally I want two buttons with the text "View Accounts" on one and "Finish" on the other?

Reply

iGuest
add Show details in message box.
Msgbox

How can I add Show details in Message box. Please anyone help me to do...

-reply by Vijee

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Recent Queries:-
  1. vb 2005, messagebox title - 1.06 hr back. (1)
  2. msgbox how to - 1.44 hr back. (1)
  3. change button captions of msgbox vb - 2.02 hr back. (1)
  4. msgboxes codes - 3.79 hr back. (1)
  5. how can i change messagebox from english to another language in vb.net - 9.24 hr back. (1)
  6. how to make a form into messagebox in vb? - 11.99 hr back. (1)
  7. messagebox syntax - 16.94 hr back. (1)
  8. syntax msgbox - 24.40 hr back. (1)
  9. title of msgbox - 24.47 hr back. (1)
  10. simple msg box example - 40.25 hr back. (1)
  11. how to change yes /no button text in message box c# - 45.27 hr back. (1)
  12. how to change messagebox button text in windows c#.net - 48.12 hr back. (1)
  13. msgbox vbyesnocancel - 60.06 hr back. (2)
  14. vb msgbox buttons caption - 62.38 hr back. (1)
Similar Topics

Keywords : msgbox, simple, lists, msgboxes

  1. How To Customize Msgbox?
    (3)


      Looking for msgbox, simple, lists, msgboxes

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for msgbox, simple, lists, msgboxes

*MORE FROM TRAP17.COM*
advertisement



Msgbox - Here is a simple way and lists of MsgBoxes.



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE