I have some problem with my Checked List Box.
public void GetFolder()
{
var dict = new Dictionary<string, string>();
foreach (Folder folder in rootfolder.FindFolders(new FolderView(100)))
{
dict.Add(folder.Id.ToString(),folder.DisplayName);
}
checkedListBox1.DataSource = new BindingSource(dict, null);
checkedListBox1.DisplayMember = "Value";
checkedListBox1.ValueMember = "Key";
}
And now i want do get all Checked List boxes,
I do this with
foreach (object item in checkedListBox1.CheckedItems)
{
lala = lala + item +"|";
}
My CheckedListbox shows me the CheckIcon and the Name of all Folders that i read from Directory, and i want now to store tie folder.Id in some Settings but only the ID but i´m getting allways Foldername and ID together.
Hope Someone can help me maybe i have some tomatoes on my eyes :)
public void GetFolder()
{
var dict = new Dictionary<string, string>();
ArrayList arr = new ArrayList();
foreach (Folder folder in rootfolder.FindFolders(new FolderView(100)))
{
dict.Add(folder.Id.ToString(),folder.DisplayName);
arr.Add(folder.Id.ToString());
}
checkedListBox1.DataSource = new BindingSource(dict, null);
checkedListBox1.DisplayMember = "Value";
checkedListBox1.ValueMember = "Key";
//Do whatever to arraylist..
}
This will give you an array list with all the ID's in it. You could bind that to a source, or run a foreach
loop to get all the items.
I'm asuming lala is your settings string.
If that is the case, use this:
lala = lala + item.Value.ToString() +"|";
This way, lala woud contain all the IDs like this: 1|2|34|567|5...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With