I want to add all selected items of checkedlistbox and combobox to a list and use that list in a for each loop in c#
I tried this
List<String> list=new List<String>();
if (rbtnMultipleScenario.Checked == true)
{
foreach ( CheckedListBox str in clbScenario.SelectedItems)
{
lstitems.Add(str);
}
}
By using String, I am not able to add all the selected items of Checkedlistbox.
Which type of list I have to use?
List<string> list=new List<string>();
if (rbtnMultipleScenario.Checked == true)
{
foreach ( string str in clbScenario.SelectedItems)
{
lstitems.Add(str);
}
}
This assumes that SelectedItems contains a collection of strings (which by your exception it does)