beginner81
Programmer
I've created a dialogBox form with 2 button on it, "Yes", and "No". When the user click at button "Yes", message "You click Yes" will prompt out. And "you click No" message will prompt out if the users click at "No" button. Here r the source code.
DialogConfirmation confirm = new DialogConfirmation ();
if (confirm.ShowDialog() == DialogResult.Yes)
{
MessageBox("You Click Yes");
}
else if (confirm.ShowDialog() == DialogResult.No)
{
MessageBox("You Click NO");
}
The problem is i have to click the "No" button twice in order to prompt out the message "You click NO" .. As far as i know, the problem raised because I've make 2 evaluation here as : if (confirm.ShowDialog() == DialogResult.Yes) and if (confirm.ShowDialog() == DialogResult.No) ..
How am i goin to solve the problem ? i know it can be easily solve by the following code:
if (confirm.ShowDialog() == DialogResult.Yes)
{
MessageBox("You Click Yes");
}
else
{
MessageBox("You Click NO");
}
but what if i have 3 or more buttons in a dialog box ?
DialogConfirmation confirm = new DialogConfirmation ();
if (confirm.ShowDialog() == DialogResult.Yes)
{
MessageBox("You Click Yes");
}
else if (confirm.ShowDialog() == DialogResult.No)
{
MessageBox("You Click NO");
}
The problem is i have to click the "No" button twice in order to prompt out the message "You click NO" .. As far as i know, the problem raised because I've make 2 evaluation here as : if (confirm.ShowDialog() == DialogResult.Yes) and if (confirm.ShowDialog() == DialogResult.No) ..
How am i goin to solve the problem ? i know it can be easily solve by the following code:
if (confirm.ShowDialog() == DialogResult.Yes)
{
MessageBox("You Click Yes");
}
else
{
MessageBox("You Click NO");
}
but what if i have 3 or more buttons in a dialog box ?