Re: msgbox syntax question
- From: "David" <myself@xxxxxxxxxxx>
- Date: Mon, 15 Jan 2007 22:42:06 -0000
Thank you very much Ken, I do remember it now...also, thanks for the
example.
Regards.
David Clifford
"Ken Halter" <Ken_Halter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23QgxqXPOHHA.3916@xxxxxxxxxxxxxxxxxxxxxxx
"David" <myself@xxxxxxxxxxx> wrote in messagerefresh
news:OitqdJPOHHA.4100@xxxxxxxxxxxxxxxxxxxxxxx
Hello all.
I once read, I think in this forum, that the msgbox syntax should be:
msgbox "Your message", vbInformation Or vbYesNo
rather than:
msgbox "Your message", vbInformation + vbYesNo
I can't remember why one uses OR instead of +, can someone please
tomy
memory?
Thank you
Regards
David Clifford
It's mostly a matter of style, as far as a messagebox goes. vbInformation,
vbYesNo and similar are bitmasks. In most cases, + will work fine, but if
you accidentally add the same flag twice (say, you're passing flags around
to different methods before using them), there can be "issues"... Using Or
to set bitmasks eliminates the possiblity of setting the wrong flags due
recursion, etc....
'==============
Private Sub Command1_Click()
Dim eBitMask As VbMsgBoxStyle
eBitMask = vbCritical
'Use Plus - Notice the buttons are not set = abort/retry/ignore
eBitMask = eBitMask + vbAbortRetryIgnore
eBitMask = eBitMask + vbAbortRetryIgnore
MsgBox "Test", eBitMask
'Reset mask
eBitMask = vbCritical
'Use Or - Notice the buttons are set = abort/retry/ignore
eBitMask = eBitMask Or vbAbortRetryIgnore
eBitMask = eBitMask Or vbAbortRetryIgnore
MsgBox "Test", eBitMask
End Sub
'==============
--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
.
- References:
- msgbox syntax question
- From: David
- Re: msgbox syntax question
- From: Ken Halter
- msgbox syntax question
- Prev by Date: Re: msgbox syntax question
- Next by Date: attn: conrad - cutting edge fast downloads - lehze dakce - (1/1)
- Previous by thread: Re: msgbox syntax question
- Next by thread: attn: conrad - cutting edge fast downloads - lehze dakce - (1/1)
- Index(es):