I want to use a CheckedListBox in an application where each item in the ListBox is the name of a folder on my hard drive and for the purpose of reading and writing text files to and from each of these folders I want to ensure that multiple item (a folder) can be selected at any time in the CheckedListBox Thanks for reading :-)
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e) { CheckedListBox.CheckedIndexCollection checkedIndices = checkedListBox1.CheckedIndices; if (checkedIndices.Count > 0) { if (checkedIndices[0] != e.Index) { checkedListBox1.ItemCheck -= checkedListBox1_ItemCheck; checkedListBox1.SetItemChecked(checkedIndices[0], true); checkedListBox1.ItemCheck += checkedListBox1_ItemCheck; } else { // the user is unchecking the currently checked item, so deselect it... checkedListBox1.SetSelected(e.Index, false); } } }
string[] filePaths = Directory.GetFiles(@"FolderPath", "*.txt", SearchOption.AllDirectories);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)