|
-
Jul 26th, 2005, 08:31 AM
#1
Thread Starter
Lively Member
[RESOLVED] Popup yes/no
How do I make a box prompting the user to answer "yes" or "no" to a question, and how would I handle which result is returned?
Cheers.
-
Jul 26th, 2005, 08:34 AM
#2
Re: Popup yes/no
VB Code:
If MessageBox.Show("Text", "Caption", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
'...said yes
Else
'...said no
End If
-
Jul 26th, 2005, 08:36 AM
#3
Thread Starter
Lively Member
Re: [RESOLVED] Popup yes/no
Solved.
-
Jul 26th, 2005, 08:36 AM
#4
Hyperactive Member
Re: Popup yes/no
Many ways. Here's a quickie:
VB Code:
Dim response as DialogResult
response = MessageBox.Show("Your message","Your Title", MessageBoxButtons.YesNo)
If response = DialogResult.Yes Then
'Do somthing
End If
-
Jul 26th, 2005, 08:47 AM
#5
Re: [RESOLVED] Popup yes/no
It may not be the case here, but many people misuse the Yes/No button combination. In the vast majority of cases you should use OK/Cancel. Here are examples of the proper use of the two.
If the user clicked an Exit button and you displayed a message box asking "Are you sure you want to exit?", the correct buttons to display would be OK and Cancel. OK means "go ahead and do what I asked for" and Cancel means "don't do what I asked for".
If the user clicked an Exit button and you displayed a message box asking "Do you want to save before exiting?", the correct buttons to display would be Yes and No. Yes means "go ahead and do what I asked for and perform the extra action" and No means "go ahead and do what I asked for but don't perform the extra action". You could also choose to display Yes, No and Cancel, where Yes and No mean the same as above and Cancel means "don't do what I asked for" again.
There are obviously other situations where Yes and No are appropriate like, if you were to ask "Do you live in the United States?", but when it comes to confirming requested actions, OK and Cancel are more generally the correct choice. In general:
OK means perform the requested action;
Yes means perform the requested action plus an additional action;
No means perform the requested action but not an additional action;
Cancel means perform no action.
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
|