hello to everybody...
in of directories on my pc i have a list of su-directories, and in each
directory theres an image "picture.ico"...
so then my program is starting to run, i add a new listviewitem to my
listview component then each item represents one of this subfolders, i also
has imagelist, and with adding new item to listview i add image
"picture.ico" to my imagelist...
.... hope my english working well in explaining myself...
-- it works this way:
foreach (System.IO.DirectoryInfo subdir in dir.GetDirectories())
{
imageList.Images.Add ( System.Drawing.Image.FromFile( subdir.FullName +
@"\picture.ico") );
System.Windows.Forms.ListViewItem lvi = new ListViewItem(subdir.Name,
imagelist.Images.Count - 1);
listView.Items.Add(lvi);
}
when time comes i decide to delete one of those sub-directories:
System.Windows.Forms.ListViewItem lvi = listView.SelectedItems[0];
System.IO.DirectoryInfo di = (System.IO.DirectoryInfo) lvi.Tag;
int i = listView.Items.IndexOf(lvi);
listView.Items.Remove(lvi);
System.Drawing.Image Image = imageList.Images[i];
imageList.Images.Remove( Image );
di.Delete(true);
but it falls on last line, saying picture.ico is in use by other program...
why is that?
and that is yours suggestions at all...
thnx...
David...