Click here to Skip to main content
15,911,786 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error in retrieving data from SQL Pin
misCafe21-May-09 16:34
misCafe21-May-09 16:34 
GeneralRe: Error in retrieving data from SQL Pin
Luc Pattyn21-May-09 17:00
sitebuilderLuc Pattyn21-May-09 17:00 
AnswerRe: Error in retrieving data from SQL Pin
dan!sh 21-May-09 17:03
professional dan!sh 21-May-09 17:03 
GeneralRe: Error in retrieving data from SQL Pin
misCafe21-May-09 18:57
misCafe21-May-09 18:57 
GeneralRe: Error in retrieving data from SQL Pin
MumbleB21-May-09 19:27
MumbleB21-May-09 19:27 
GeneralRe: Error in retrieving data from SQL Pin
misCafe21-May-09 20:33
misCafe21-May-09 20:33 
QuestionRepeated code with little difference Pin
Xenoserv21-May-09 12:09
Xenoserv21-May-09 12:09 
AnswerRe: Repeated code with little difference Pin
Luc Pattyn21-May-09 12:46
sitebuilderLuc Pattyn21-May-09 12:46 
Hi,

this does not make much sense to me. What is the use of storing the checked state in a string which is inside the Tag property, when the Checked state is already available as a boolean?

Anyway, this probably is what you asked for:
foreach(Control c in Controls) {
    CheckBox cb=c as CheckBox;
    if (cb!=null) cb.Tag=cb.Checked?"1":"0";
}


works whatever the number of checkboxes is, as long as they are all present in this.Controls
(if they are nested in panels, groupboxes, whatever, you may need some recursion).

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

AnswerRe: Repeated code with little difference Pin
_Maxxx_21-May-09 17:30
professional_Maxxx_21-May-09 17:30 
QuestionSleek looking window application Pin
humayunlalzad21-May-09 12:09
humayunlalzad21-May-09 12:09 
AnswerRe: Sleek looking window application Pin
EliottA21-May-09 12:37
EliottA21-May-09 12:37 
AnswerRe: Sleek looking window application Pin
_Maxxx_21-May-09 17:32
professional_Maxxx_21-May-09 17:32 
GeneralRe: Sleek looking window application Pin
humayunlalzad22-May-09 5:21
humayunlalzad22-May-09 5:21 
QuestionHow to get custom attributes from a function called by delegate? [modified] Pin
Anindya Chatterjee21-May-09 11:24
Anindya Chatterjee21-May-09 11:24 
Questiondatagrid reorder Pin
michaelgr121-May-09 10:19
michaelgr121-May-09 10:19 
AnswerRe: datagrid reorder Pin
Luc Pattyn21-May-09 10:30
sitebuilderLuc Pattyn21-May-09 10:30 
AnswerRe: datagrid reorder Pin
michaelgr121-May-09 19:40
michaelgr121-May-09 19:40 
GeneralRe: datagrid reorder Pin
Luc Pattyn22-May-09 2:05
sitebuilderLuc Pattyn22-May-09 2:05 
QuestionHttpWebRequest and something to do with security level... Pin
SimpleData21-May-09 9:21
SimpleData21-May-09 9:21 
AnswerRe: HttpWebRequest and something to do with security level... Pin
Manas Bhardwaj21-May-09 11:12
professionalManas Bhardwaj21-May-09 11:12 
GeneralRe: HttpWebRequest and something to do with security level... Pin
SimpleData22-May-09 3:20
SimpleData22-May-09 3:20 
Questionhow to ceate event_click for button with C# ? [modified] Pin
xingselex21-May-09 9:18
xingselex21-May-09 9:18 
AnswerRe: how to ceate event_click for button with C# ? Pin
Luc Pattyn21-May-09 10:15
sitebuilderLuc Pattyn21-May-09 10:15 
AnswerRe: how to ceate event_click for button with C# ? Pin
_Maxxx_21-May-09 17:35
professional_Maxxx_21-May-09 17:35 
Questionhow create a Function return as DataTable with C# ? Pin
xingselex21-May-09 8:22
xingselex21-May-09 8:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.