Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an app.config file with certain settings with key-value pair. I need to populate a checkedboxlist with these values on form load. How can i code this?
Posted
Comments
Kornfeld Eliyahu Peter 29-Dec-14 7:20am    
http://mattgemmell.com/what-have-you-tried/
dev_assault 30-Dec-14 7:54am    
do you have config sections or straight away appsettings.....as i had the same scenario once where in i had to fill config section key and values into data grid view row cell and data grid view combo box....and upadte value in config section through the datagridview combo box....so describe your issue a bit and i might know exactly about it...

1 solution

You can get values from App.config by:
C#
string filetype = ConfigurationSettings.AppSettings [ "filetype" ] ;

Then you can populate the checkedlistbox by:
C#
var items = checkedListBox1.Items;
	    items.Add("Perls");
	    items.Add("Checked", true); 

Some more reference for your clerance:
Read/Write App.Config File with .NET 2.0[^]
Reading values from app.config[^]
C# getting value from app.config[^]
 
Share this answer
 
Comments
BillWoodruff 29-Dec-14 11:05am    
What has receiving the setting for 'filetype got to do with the code you show for populating a CheckedListBox ? Did you forget to use 'filetype ?

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