How to add "checkbox1.text" to a variable "res" if the "checkbox1.checked" is 'true' or else remove the "checkbox1.text" from the variable "res"?


  • C#: 
         In my Project, I have 4 checkboxes. If i checked, any of these the checkboxes then that checkbox's text should be appended to the variable "res" along with some delimitor operator "/" between the checkboxes' text. And remove the checkboxes' text if any of them is unchecked. see the below example

          I have to Add the "text " of a "checkbox1" to a variable "res" if that checkbox1 is "checked ". And Remove the "text" of that "checkbox1 " from the variable "res " , if the "checkbox1" is "unchecked"

    For Example:

    I have 4 checkboxes labelled namely "ABC" , "DEF" , "GHI" , "JKL" . and i take a string variable "res " with null value.

    If i checked the "ABC"checkbox then string variable as "res=ABC ".

    If i checked the "ABC"checkbox and "GHI"checkbox and "JKL"checkbox then string variable should be "res=ABC/GHI/JKL ".
    Now i unchecked the "ABC"checkbox and checked the "DEF"checkbox then the string variable should be "res=GHI/JKL/DEF "

    • Edited by Get me Ur Idea Sunday, September 13, 2009 5:48 AM for clarity purpose
    Saturday, September 12, 2009 9:20 PM


All replies