Question

In the program I'm writing I've come into a bit of dilema

DialogResult result;

result = MessageBox.Show("question", "title", MessageBoxButtons.YesNo);
if(result == DialogResult.Yes){
    //dosomething
}
else if(DialogResult.No){
    //dosomethingdifferent
}

the issue at hand is that the X becomes non-clickable, and I like that x to be clickable... now a workaround can be found by replacing MessageBoxButtons.YesNo with MessageBoxButtons.YesNoCanel but that adds a cancel button I would prefer not be there. the differences between what I want to do with no and the x are not that large, one just assures the user he pressed no rather then yes, while the other just does nothing.

so onto the question, how can I get the red x to work with just .YesNo and not have to add a cancel button

Was it helpful?

Solution

I think the dialog box disables the X for YesNo because uniformity of the interface is important for a GUI. Yes/no is an exclusive choice by the user, while the X or cancel button have another semantic which cannot and should not be confused with answering no.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top