Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 10:48am
Comments
SAKryukov at 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 at 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
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Manfred R. Bihy at 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 at 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
good
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,
 
—MRB
  Permalink  
v2
Comments
Simon Bang Terkildsen at 29-Aug-11 16:03pm
   
+5
Rate this: bad
good
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.
  Permalink  
Comments
Manfred R. Bihy at 29-Aug-11 16:02pm
   
That's the best solution! 5+
 
Proposed as the solution.
wizardzz at 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 at 29-Aug-11 19:13pm
   
Good point :)
SAKryukov at 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)

  Print Answers RSS
0 OriginalGriff 275
1 DamithSL 265
2 CPallini 235
3 Maciej Los 185
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 29 Aug 2011
Copyright © CodeProject, 1999-2014
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