Guyz
Is it possible to have a "OK" and "Cancel" option in a MsgBox or "Yes"
or "No"? :confused:
Or should I make a new form to do that?
Thanks........ :afrog:
Printable View
Guyz
Is it possible to have a "OK" and "Cancel" option in a MsgBox or "Yes"
or "No"? :confused:
Or should I make a new form to do that?
Thanks........ :afrog:
VB Code:
MsgBox "OK/Cancel Message", vbOkCancel,"Title" MsgBox "Yes/No Message", vbYesNo,"Title" MsgBox "Yes/No/Cancel Message + Exclamation", vbYesNoCancel + VbExclamation,"Title" MsgBox "Critical Message", VbCritical,"Title" MsgBox "Info Message", VbInformation,"Title"
and to support the above post by jcis, to identify what button is pressed, you can do it by
VB Code:
dim a a = msgbox "your prompt here", vbyesno,"title here" if a = vbyes then 'yes button is clicked else 'no button is clicked endif 'same is true with other button groups
a variable can be declared as VbMsgBoxResult
Thanks again guyz!! :wave:
Welcom
Simple MsgBox additionally from CheckBox
VB Code:
Option Explicit 'Copyright (C) 2005 DJK's Projects (DJK) 'side of WWW, also in English language: [url]http://djkprojects.prv.pl/[/url] 'Contact: [email][email protected][/email] 'The author of example doesn't answer for possible damages called out the working following code. Private Const IDI_HAND = 32513& Private Const IDI_QUESTION = 32514& Private Const IDI_EXCLAMATION = 32515& Private Const IDI_ASTERISK = 32516& Private Const MB_ICONHAND = &H10& Private Const MB_ICONQUESTION = &H20& Private Const MB_ICONEXCLAMATION = &H30& Private Const MB_ICONASTERISK = &H40& Private Declare Function LoadIcon Lib "user32" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Any) As Long Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long Private Declare Function DestroyIcon Lib "user32" (ByVal hIcon As Long) As Long Private Declare Function MessageBeep Lib "user32" (ByVal wType As Long) As Long Private Sub cmdNo_Click() Unload Me End Sub Private Sub Form_Load() ShowMsgBox IDI_ASTERISK, MB_ICONASTERISK, "ExtraMsgBox", "http://djkprojects.prv.pl" End Sub Private Sub ShowMsgBox(ByVal IconStyle As Long, ByVal BeepStyle As Long, ByVal Caption As String, ByVal Message As String) Dim hIcon As Long With picIcon .Top = 150 .Left = 150 .AutoRedraw = True .BorderStyle = 0 .Width = 32 * Screen.TwipsPerPixelX .Height = 32 * Screen.TwipsPerPixelY End With With lblMsg .Left = 870 .Top = 300 End With hIcon = LoadIcon(0&, IconStyle) Call MessageBeep(BeepStyle) Form1.Caption = Caption lblMsg.Caption = Message Call DrawIcon(picIcon.hdc, 0, 0, hIcon) Call DestroyIcon(hIcon) End Sub