Click here to Skip to main content
13,054,329 members (122,861 online)
Rate this:
Please Sign up or sign in to vote.
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 29-Aug-11 9:48am
SAKryukov 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?!
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Manfred R. 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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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,

Simon Bang Terkildsen 29-Aug-11 16:03pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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.
Manfred R. 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 :)
SAKryukov 29-Aug-11 23:08pm
Most reasonable advice, my 5.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 29 Aug 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100