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.ic o" to my imagelist...
.... hope my english working well in explaining myself...
-- it works this way:
foreach (System.IO.Dire ctoryInfo subdir in dir.GetDirector ies())
{
imageList.Image s.Add ( System.Drawing. Image.FromFile( subdir.FullName +
@"\picture.ico" ) );
System.Windows. Forms.ListViewI tem lvi = new ListViewItem(su bdir.Name,
imagelist.Image s.Count - 1);
listView.Items. Add(lvi);
}
when time comes i decide to delete one of those sub-directories:
System.Windows. Forms.ListViewI tem lvi = listView.Select edItems[0];
System.IO.Direc toryInfo di = (System.IO.Dire ctoryInfo) lvi.Tag;
int i = listView.Items. IndexOf(lvi);
listView.Items. Remove(lvi);
System.Drawing. Image Image = imageList.Image s[i];
imageList.Image s.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...