Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how can i retrieve dynamic generated check-boxes value if they are checked, in win forms group controls ...
Posted

foreach (Control c in myGroupBox.Controls) {
    CheckBox cb = c as CheckBox;
    if ((cb != null) && cb.Checked) {
        // Do whatever you want here
    }
}
/ravi
 
Share this answer
 
Comments
mukesh mourya 20-Apr-14 3:36am    
sir i am new for win application so i have no idea for make a .exe file with database(Sql server) attachment, and how can i run script of database with installation this exe
BillWoodruff 20-Apr-14 6:02am    
I suggest you revise your original post so it reflects what you are actually doing and what you wish to achieve. We are not psychics ! Ravi's answer here is a perfectly valid answer to your current question.
mukesh mourya 20-Apr-14 12:19pm    
ya BillWoodruff, i fully accept ravi post, but this was my one more Question. please guide me ...
Ravi Bhavnani 20-Apr-14 13:18pm    
See this article:

http://www.codeproject.com/Articles/10032/Deploy-SQL-Server-databases-easily-with-an-Install

/ravi
You can also gather all the CheckBox Controls using Linq's OfType<> method:
C#
// required
using Linq;

// in some method or EventHandler:

List<checkbox> cbList = someGroupBox.Controls.OfType<checkbox>().ToList();

foreach(CheckBox cb in cbList)
{
    // do something with the CheckBox

    if(cb.Checked)
    {
       // it's checked
    }
    else
    {
       // it's not checked
    }
}</checkbox></checkbox>
 
Share this answer
 

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