You should create a type that holds the full path and override ToString() to return what you want to display in the CheckedListBox. CheckedListBox.SelectedItems will then hold a list of your type.
public void PopulateListBox()
{
_checkedListBox.Items.Add(new BackupDir(@"C:\foo\bar\desktop", "Desktop"));
}
public void IterateSelectedItems()
{
foreach(BackupDir backupDir in _checkedListBox.CheckedItems)
Messagebox.Show(string.format("{0}({1}", backupDir.DisplayText, backupDir.Path));
}
public class BackupDir
{
public string Path { get; private set; }
public string DisplayText { get; private set; }
public BackupDir(string path, string displayText)
{
Path = path;
DisplayText = displayText;
}
public override string ToString()
{
return DisplayText;
}
}
you could of course strip the folder name from the path if that is what you wanted to do for every list item and just have the path arg on the BackupDir class.