Click here to Skip to main content
15,915,513 members
Home / Discussions / C#
   

C#

 
AnswerRe: IE Page size Pin
Kevin Marois18-May-10 5:10
professionalKevin Marois18-May-10 5:10 
GeneralRe: IE Page size Pin
Luc Pattyn18-May-10 5:58
sitebuilderLuc Pattyn18-May-10 5:58 
GeneralRe: IE Page size Pin
Kevin Marois18-May-10 6:00
professionalKevin Marois18-May-10 6:00 
QuestionOutlook 2007 - Editing calendar information Pin
lvq68418-May-10 3:11
lvq68418-May-10 3:11 
AnswerRe: Outlook 2007 - Editing calendar information Pin
OriginalGriff18-May-10 4:53
mveOriginalGriff18-May-10 4:53 
GeneralRe: Outlook 2007 - Editing calendar information Pin
lvq68418-May-10 7:43
lvq68418-May-10 7:43 
Questionmodifying a html file in windows c# application Pin
Suunil18-May-10 3:00
Suunil18-May-10 3:00 
AnswerRe: modifying a html file in windows c# application Pin
The Man from U.N.C.L.E.18-May-10 3:07
The Man from U.N.C.L.E.18-May-10 3:07 
GeneralRe: modifying a html file in windows c# application Pin
Suunil18-May-10 3:11
Suunil18-May-10 3:11 
GeneralRe: modifying a html file in windows c# application Pin
T M Gray18-May-10 5:10
T M Gray18-May-10 5:10 
AnswerRe: modifying a html file in windows c# application Pin
Not Active18-May-10 3:54
mentorNot Active18-May-10 3:54 
AnswerRe: modifying a html file in windows c# application Pin
Suunil20-May-10 3:02
Suunil20-May-10 3:02 
QuestionReading integer from an xml file Pin
acont18-May-10 2:41
acont18-May-10 2:41 
AnswerRe: Reading integer from an xml file Pin
Seishin#18-May-10 4:40
Seishin#18-May-10 4:40 
GeneralRe: Reading integer from an xml file Pin
acont18-May-10 5:23
acont18-May-10 5:23 
AnswerRe: Reading integer from an xml file Pin
PIEBALDconsult18-May-10 4:56
mvePIEBALDconsult18-May-10 4:56 
QuestionPlz, des'nt File Delete ,, [modified] Pin
sonic74718-May-10 0:25
sonic74718-May-10 0:25 
i want delete image file.
very well insert image file to listbox.
but, does'nt delete image file ,
plz, take me a error,,
---
c#, wpf, .net3.5
/....
source code
attched project files,
source file download

//////////error code////
//image insert to listbox///
private void button1_Click(object sender, RoutedEventArgs e)
{
savepath = System.Environment.CurrentDirectory.ToString();

foreach (string f in Directory.GetFiles(savepath + "/image", "*.jpg"))
{
BitmapImage my;
my= new BitmapImage();
my.BeginInit();
my.CacheOption = BitmapCacheOption.OnLoad;
my.UriSource = new Uri(f, UriKind.RelativeOrAbsolute);
my.EndInit();
listBox1.Items.Add(my);

}


}
/////////delete image file ///
private void button2_Click(object sender, RoutedEventArgs e)
{
string makestr1, item1;
item1 = listBox1.Items[0].ToString();
makestr1 = item1.Substring(8, item1.Length - 8);

listBox1.Items.Remove(listBox1.Items[0]);
if (System.IO.File.Exists(makestr1))
{

System.IO.File.Delete(makestr1); //<--error point
}
else
MessageBox.Show("Nothingfile");
}


//error message..

modified on Tuesday, May 18, 2010 7:31 AM

AnswerFile not deleting [modified] Pin
DaveyM6918-May-10 0:32
professionalDaveyM6918-May-10 0:32 
GeneralRe: File not deleting Pin
Johnny J.18-May-10 1:25
professionalJohnny J.18-May-10 1:25 
GeneralRe: File not deleting Pin
DaveyM6918-May-10 2:08
professionalDaveyM6918-May-10 2:08 
AnswerRe: Plz, des'nt File Delete ,, Pin
Luc Pattyn18-May-10 1:10
sitebuilderLuc Pattyn18-May-10 1:10 
AnswerRe: Plz, des'nt File Delete ,, Pin
sonic74718-May-10 1:30
sonic74718-May-10 1:30 
GeneralRe: Plz, des'nt File Delete ,, Pin
Not Active18-May-10 2:41
mentorNot Active18-May-10 2:41 
GeneralRe: Plz, des'nt File Delete ,, Pin
William Winner18-May-10 7:29
William Winner18-May-10 7:29 
AnswerRe: Plz, des'nt File Delete ,, Pin
Seishin#18-May-10 4:39
Seishin#18-May-10 4:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.