Click here to Skip to main content
16,017,638 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have twenty checkboxes in my form...now i select five checkbox and store that text in database then if i again run that program i want to hide that already selected check boxes? how to write coding?
Posted
Updated 4-Aug-13 21:57pm
v2

1 solution

We can't be specific, as a lot of it depends on how you store your info, how you display the checkboxes and so forth.
If I assume that your "Twenty checkboxes" are dynamically added to the form at run time an your store a checkbox number in the database then it's simple: read the values from the DB and store them in a List<int> - when you create the checkbox, see if the list contains the number and if so set the CheckBox.Visible (or probably better CheckBox.Enabled) to false.

A similar process would be used if they are static and added at design time, but with the added complication that you need to either set up an array or list of the checkboxes to check, or run through the container objects Controls collection to find the appropriate entry.
 
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