Pavi S

Pavi S

  • NA
  • 41
  • 74.6k

how to get the prevoius checked item values from checkedlist

Mar 6 2013 1:16 AM
how to get the prevoius checked item values from checkedlistbox using c#

i checked some items in checkedListBox and closed the checkedListBox , again when i open the checkedListBox , the previous checked values should be in same checked condition. how can i get that prevoius checked items.

im using forms.my process is
1.Getting word files from the specified folder
2.Have to add word files name to the checkedlistbox
3.i want select some files from checkedlistbox so i checked some files
4.i checked some item and closed the forms(ie.checkedlistbox)
5.again i load the form so its again get the file from the folder, in this i need the prevoius checking item, that means prevoius checked items should be same checked position in checkedboxlist in current.

private void FormFiles_Load(object sender, EventArgs e)
        {
            this.GetFiles();

        }

        public void GetFiles()
        {

            var items = checkedListBox1.Items;

            DirectoryInfo dir = new DirectoryInfo(@"E:\2013\Tasks\3");

            foreach (FileInfo file in dir.GetFiles("*.doc"))
            {
                File.Copy(file.FullName, file.Name, true);

                items.Add(file.Name);

           }
}


Answers (1)