|
|
|
|
![]() ![]() |
Nov 17 2005, 05:46 AM
Post
#11
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 67 Joined: 16-November 05 Member No.: 14,373 |
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. |
|
|
|
Nov 17 2005, 08:07 AM
Post
#12
|
|
|
Trap Grand Marshal Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,203 Joined: 25-March 05 Member No.: 4,883 |
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 ![]() CODE Windows.Forms.MessageBox.Show("This is a plain messagebox." & vbCrLf & "It's got a caption too.", "This is the caption.") Is shown as ![]() ---------------------------------------------------------------------------------------------- Message Boxes with Different Button Types CODE Windows.Forms.MessageBox.Show("It's got Abort, Retry, Cancel buttons.", "", MessageBoxButtons.AbortRetryIgnore) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("It's got OK button.", "", MessageBoxButtons.OK) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("It's got OK, Cancel buttons.", "", MessageBoxButtons.OKCancel) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("It's got Retry, Cancel buttons.", "", MessageBoxButtons.RetryCancel) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("It's got Yes, No buttons.", "", MessageBoxButtons.YesNo) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("It's got Yes, No, Cancel buttons.", "", MessageBoxButtons.YesNoCancel) Is shown as ![]() ---------------------------------------------------------------------------------------------- Message Boxes with Different Alert Types CODE Windows.Forms.MessageBox.Show("An Asterisk type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("An Error type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Error) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("An Exclamation type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("A Hand type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Hand) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("An Information type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Information) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("A None type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.None) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("A Question type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Question) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("A Stop type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Stop) Is shown as ![]() CODE Windows.Forms.MessageBox.Show("A Warning type icon.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning) Is shown as ![]() 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 |
|
|
|
Nov 17 2005, 08:24 AM
Post
#13
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 67 Joined: 16-November 05 Member No.: 14,373 |
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. |
|
|
|
Nov 19 2005, 01:44 PM
Post
#14
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 22 Joined: 19-November 05 Member No.: 14,564 |
Could we change buttom "YES","NO","CANCEL" to other caption?
|
|
|
|
Nov 19 2005, 02:29 PM
Post
#15
|
|
|
Trap Grand Marshal Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,203 Joined: 25-March 05 Member No.: 4,883 |
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.. |
|
|
|
Nov 22 2005, 11:00 AM
Post
#16
|
|
|
Neurotical Squirrel ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 590 Joined: 4-November 04 From: Novi Sad, Vojvodina Member No.: 2,127 |
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 |
|
|
|
Nov 26 2007, 01:11 PM
Post
#17
|
|
|
Hail Caesar! ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 5,876 Joined: 21-September 07 Member No.: 50,369 |
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? |
|
|
|
Jun 4 2008, 07:21 AM
Post
#18
|
|
|
Hail Caesar! ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 5,876 Joined: 21-September 07 Member No.: 50,369 |
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 |
|
|
|