Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Experts,

A very quick question. If I have two radio buttons Rbn1, Rbn2 in windows forms application. And if user first checks the Radio button Rbn1 and changes mind to check it to Rbn2. Can ask user Are you sure message? If yes, how do I know that he already checked Rbn1 first and then clicked on Rbn2?
Should I write code in Rbn2 checked change event ? But it shows current as Rbn2 is checked
Should I make some flag to know ?


Ideas/suggestions are much appreciated.

Thanks
Posted

1 solution

How? By handling the event RadioButton.CheckedChanged event, of course: https://msdn.microsoft.com/en-us/library/system.windows.forms.radiobutton.checkedchanged%28v=vs.110%29.aspx[^].

How to know what was checked before? Of course, by recording some set of previous sets of some controls in some memory area, typically a queue. That's all.

Now, please listen carefully. It's hard to invent worse UI abuse and the worse way to confuse the user. No, the user does not want your warning message, as well as any other brainwash. If the user clicks some radio button, that person means it. If something was selected by mistake, the users can see what is selected. You are trying to create the behavior depending on history, and this is impossibly bad. Now, just think about it: your application "knows" that state, but the user cannot see it. The pretty good rule would be: no hidden states.

You can warn the user of wrong choice, only when it is final. You can collect all the states of all relevant control and inform the user one the implications, but only at the moment of time when the use of this choice is about to become irreversible.

—SA
 
Share this answer
 
v3
Comments
sudevsu 22-Apr-15 9:33am    
Exactly SA. That's what I told my boss. "But the people who use this dashboard is from Sales Department and they are so poor in understanding things" was his answer. I told him using flags or something to know the history of selection is not a good idea. I remember someone teaching me that Flags aren't always a good idea to use. I tried to tell my boss that user wont like too many pop up messages.
Sergey Alexandrovich Kryukov 22-Apr-15 9:58am    
It happens. Worst thing is when people tries to make things more clearly by adding behavior (instead of real simplification) which makes the understanding completely messed up. Creation of understandable UI and behavior in general is real art, and the goal is to make it self-explainable. Possible consequences of each event should be easily foreseeable.

Perhaps you can show this post to this person. Moreover, underscore brainwash shows the link to my last 1st of April article, a satire on "brainwash" and related thing (stronger word is discussed :-) which, being a 1st of April joke, is serious enough to study before making decisions. :-)

—SA
sudevsu 22-Apr-15 10:13am    
Yeah I would probably do that. I will show him this post
Sergey Alexandrovich Kryukov 22-Apr-15 10:18am    
Good luck. :-)
—SA
sudevsu 22-Apr-15 15:41pm    
ohuuuuu... He finally agreed ... Thank you so much SA. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900