Click here to Skip to main content
15,889,600 members
Home / Discussions / C#
   

C#

 
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 
QuestionCombobox SelectedValue Problem. Pin
Dotnetkanna17-May-10 23:30
Dotnetkanna17-May-10 23:30 
AnswerRe: Combobox SelectedValue Problem. Pin
Abhinav S18-May-10 0:34
Abhinav S18-May-10 0:34 
AnswerRe: Combobox SelectedValue Problem. Pin
Seishin#18-May-10 4:46
Seishin#18-May-10 4:46 
QuestionHow can save picturebox image using menustrip Pin
Nivas8217-May-10 21:00
Nivas8217-May-10 21:00 
AnswerRe: How can save picturebox image using menustrip Pin
William Winner18-May-10 8:00
William Winner18-May-10 8:00 
GeneralRe: How can save picturebox image using menustrip Pin
Nivas8218-May-10 19:18
Nivas8218-May-10 19:18 
GeneralRe: How can save picturebox image using menustrip Pin
William Winner19-May-10 5:29
William Winner19-May-10 5:29 
GeneralRe: How can save picturebox image using menustrip Pin
Nivas8219-May-10 23:13
Nivas8219-May-10 23:13 
GeneralRe: How can save picturebox image using menustrip [modified] Pin
Nivas8220-May-10 20:54
Nivas8220-May-10 20:54 

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.