Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I want to pop up an error messsage in a radio button list example.if user fails to select a button i want to a pop up showing an error message saying you have to select each buton. how do I do that. Can I have the code please.
Posted
Comments
Sergey Alexandrovich Kryukov 29-Aug-11 23:06pm    
What do you mean "in C#"? This is not about language but about UI library. Tag it: WPF, Forms, APS.NET, what?!
--SA
BillWoodruff 30-Aug-11 0:01am    
Such great answers, such an ambiguous question :) 'Radio Buttons' in .NET, in one container, can have only one Button selected/active at a time. And, once one is selected, if you want to make sure none are selected, you have to do that in code. Without knowing specifically what you mean by "radio button list" and what you are trying to do ... can't say more.

 
Share this answer
 
Comments
Manfred Rudolf Bihy 29-Aug-11 15:52pm    
That would be the "How" as OP specifically asked for! 5+

I'll try to get OP to think about the "when" too :).
wizardzz 29-Aug-11 16:03pm    
Haha, thanks. I know, I'm trying to keep the blatant sarcasm out of QA since Chris's Lounge post last week.
If you really don't know the "How" then look at wizzards solution. I'm quite sure that you're not really concerned with "how" to show the message, but rather the "When".

Without knowing the intended workflow within your windows form application it's kind of hard to tell. I'll assume that you're doing a WinForm application and not doing ASP.NET as you didn't tag your question with ASP.NET.

If there is a button that gets pressed to process the form, that buttons click method would be the ideal place to check if a radio button is selected and show the message.

Best Regards,

—MRB
 
Share this answer
 
v2
Comments
Simon Bang Terkildsen 29-Aug-11 16:03pm    
+5
Instead of doing it that way, use the event mechanism to set flags, and enable/disable the buttons as appropriate. Users HATE being interrupted by message box popups.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 29-Aug-11 16:02pm    
That's the best solution! 5+

Proposed as the solution.
wizardzz 29-Aug-11 16:06pm    
I agree with this completely. Interrupting control of the application to tell the user they are dumb is very annoying. I almost always use flags for the purpose of required fields. I do still use popups if someone is about to do something verrrry stupid.
Espen Harlinn 29-Aug-11 19:13pm    
Good point :)
Sergey Alexandrovich Kryukov 29-Aug-11 23:08pm    
Most reasonable advice, my 5.
--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