Click here to Skip to main content
16,009,114 members
Please Sign up or sign in to vote.
1.11/5 (2 votes)
See more:
How can we create check box at runtime based on row count?
Posted
Comments
Richard C Bishop 13-May-13 17:40pm    
Use a for loop. See example below.

1 solution

Here is an example of a for loop creating check boxes dynamically based on a row count:
for(int i = 0; i < DataTable.Rows.Count, i++)
{
    CheckBox cb = new CheckBox();
    cb.ID = i;
    Form1.Controls.Add(cb);    
}
 
Share this answer
 
v2

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