|
-
Jan 23rd, 2000, 11:34 AM
#1
Thread Starter
Addicted Member
Just wondering how i would specify vbCritical and vbCancelRetry together on a message box.
The and and or keywords didn't work.
-
Jan 23rd, 2000, 11:40 AM
#2
Lively Member
use the "+" sign to join the the two constant values.
------------------
-
Jan 23rd, 2000, 11:40 AM
#3
vbCritical + vbCancelRetry
------------------
Marty
Can you buy an entire chess set in a pawn shop?
-
Jan 23rd, 2000, 09:35 PM
#4
Example:
call MsgBox("Are you sure you want to remove this record?", vbQuestion + vbYesNo + vbDefaultButton2, "Remove")
-
Jan 23rd, 2000, 09:56 PM
#5
So Unbanned
or you can use the numerical way(easiest)
where as:
vbCritical = 16
vbQuestion = 32
vbExclamation = 48
vbInformation = 64
and...
OK/Cancel = 1
Abort/Retry/Ignore = 2
Yes/No/Cancel = 3
Yes/no = 4
Retry/Cancel = 5
then the replies:
OK=1
Cancel=2
Abort=3
Retry=4
Ignore=5
Yes=6
No=7
---
then you just add them i.e. I want vbcritical(16) and vbcancelretry(5) = 21
reply = msgbox("You messed up!",21 ,"Critical Error!")
if reply = 2 then
Msgbox "Fine let your computer die!",16,"Good-Bye!"
else
msgbox "Re-try to install my virus? SURE!",48,"This can be fun..."
end if
Have fun,
------------------
DiGiTaIErRoR
-
Jan 23rd, 2000, 11:26 PM
#6
I'm sorry, but using numbers rather than the built-in variables is really a bad idea! When you go back 6 months from now and look at your code, which would be easier to understand of the following?
reply = MsgBox("You messed up!", 21, "Critical Error!")
-or-
reply = MsgBox("You messed up!", vbCritical + vbRetryCancel, "Critical Error!")
6 months from now will you remember what 21 is? I sure wouldn't want to have to maintain a program like that. Also, while it's almost 100% sure they wouldn't do it, MS could change the number that, for example, produces a "critical" message from 16 to some other value. So where the number version above would stop working (or worse yet, stop working correctly), MS would at the same time change the value behind vbCritical and it would be transparent to you and the vbCritical version would have no problem.
------------------
Marty
Can you buy an entire chess set in a pawn shop?
-
Jan 23rd, 2000, 11:32 PM
#7
Thread Starter
Addicted Member
Thank you all 
------------------
Micah Carrick
http://micah.carrick.com
[email protected]
ICQ: 53480225
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|