المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Delete a pdf in a webbrowser



C# Programming
02-15-2010, 10:03 AM
HELLO EVERYBODY,
I have a problem, I load a pdf in a webbrowser in Windows, in this event


string gcPthTMP = @"C:\TMP\";
string gcPthTrans = @"C:\TRANS\";

private void frmWebBrowser_Load(object sender, EventArgs e)
{
Uri uriPdf = new Uri(gcPthTMP + fileName);
this.webBrowser.Url = uriPdf;
}

This works fine, the problem is when I want to delete this file, i do:

private void frmWebBrowser_FormClosed(object sender, FormClosedEventArgs e)
{
this.webBrowser.Dispose();
this.*******();
System.Threading.Thread.Sleep(1000);
string fileName = this.txtUrl.Text.ToString().Trim();
this.Dispose(true);
if (System.IO.File.Exists(gcPthTMP + fileName))
{
System.IO.File.Delete(gcPthTMP + fileName);
}
}

this works fine in Vista, because delete the file without any problem, but the problem is in XP, this produce a error It says that the process is using by other process. Please help me, Ineed to solve this problem.

Thanks