Library tutorials & articles
MsgBox Function
By James Crowley, published on 14 Jul 2001
Page 5 of 5
- Introduction
- Parameters
- Usage
- Default Buttons
- Closing automatically
Closing automatically
You will have noticed that sometimes in other applications a message box closes
itself automatically after a period of time (such as the error message when
printing, saying that the printer is out of paper). You can actually do this
in Visual Basic.
Click here for
the code.
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
hi,
is it possible to have something which will display the information (information is one or two lines of text) for few seconds and disappear. if i use msgbox for it, there are many message boxes in the application which becomes annoying to the user.
do i have to create a new form for it or there is another function.
thanx in advance,
bye
Hello
dear i dont know how i can add icons in menu bar in visual basic .
plaease help me to solve this problem.
khuram
No, you need to make a new form that looks like a message box for that.
Dim ans As String
ans = MsgBox("Would you like to save changes?", vbYesNoCancel)
If ans = vbYes Then
'Put your Yes commands in here
Else
If ans = vbNo Then
'Put your No commands in here
Else
'Put your Cancel commands in here
End If
End If
if msgbox("Do you want to save changes",vbyesnocancel)=vbyes then
' saving document
Else
' could be EITHER CANCEL OR NO
End if
can you see the problem?
I am not an expert infact im only 13 however i have been doing vb for about 2 years and i have sure done a lot with the msgbox() function and i do remember reading somewere that you cannot add or remove buttons from the default messages that vb has already installed for you, however if you build yourown msgbox the possibilities are endless you can even add images and movies and anything u can think of , the easiest and lamest way to do this is to make a new form and call it say........"Message1" make 2 Buttons (Command1 and Command2) and make the "Message1" default BorderStyle
03 - Fixed Dialog then it will look like a normal window then u can manually set the height and width to whatever u like and then just have tha application load the "Message1" form whenever u need the message box and actually those types of message boxes are the easiest to code for desisions like if u have "ya" and the user clicks it u just code the Command1 for "ya" and command2 for "Tidak"
THAT SHOULD WORK!!!!
if it doesnt send me an email at Fruit_Cake70@hotmail.com
good luck with your application
Example I want to add:
button vbYa (which is in Malay) and the button caption is "Ya" (equal to Yes in English)
button vbTidak (in Malay) and the caption is "Tidak" (equal to No in English)
it's about changing the msgbox caption into my own Language.
thanks
I'm fairly new to VB but picking it up quite well.
Can I use custom buttons in a MsgBox? Like, if I want 'Fred', 'Bob' and 'Cancel'.
Button2 would be for no and Button3 is for cancel...
Msgbox "Do you want to save changes?", vbYesNoCancel+vbExclamation+vbDefaultButton3 , "Front Page"
would set the default button as No.
vbDefaultButton3 is the button for No? Is button2 for cancel? Would we want the user to cancel if they accidently pressed enter so they would make the choice of yes or no?
I am new so bear with me! Thanks.
This thread is for discussions of MsgBox Function.