mechtn
August 6th, 2002, 12:49 PM
An unhandled exception of type 'System.IO.IOException' occurred in
mscorlib.dll
Additional information: The process cannot access the file
"c:\Fax\524b2cfa00.tif" because it is being used by another process.
Tried..
File.Delete(curfax)
Kill(curfax)
oFileInfo = New System.IO.FileInfo(curfax)
oFileInfo.Delete()
i loaded the file into a picbox and then read the name of the file and path into a listbox. I'm setting the picbox to nothing, and deleting the file based on selected item.
this is my code for getting rid of it...
Dim movefax, curfax As String
Dim fi As New FileInfo(fswFaxWatcher.Path & "\" &
lstFaxes.SelectedItem.ToString)
curfax = fswFaxWatcher.Path & "\" & lstFaxes.SelectedItem
movefax = fswFaxWatcher.Path & "\Archive\" &
lstFaxes.SelectedItem
If File.Exists(movefax) Then
'MsgBox("Files Already Exists, Deleting Old File.",
MsgBoxStyle.Critical)
File.Delete(movefax)
End If
fi.CopyTo(movefax)
movefax = Nothing
lstFaxes.Items.Remove(lstFaxes.SelectedItem)
lstFaxes.ClearSelected()
picFax.Image = Nothing
picFax.Height = 0
picFax.Width = 0
If MessageBox.Show("Delete the selected files (files will be
permanently deleted)?", "Confirm Delete", MessageBoxButtons.OKCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly) = DialogResult.OK Then
Dim delfile As System.IO.FileInfo
Try
delfile = New System.IO.FileInfo(curfax)
delfile.Delete()
Catch oops As Exception
MessageBox.Show("Error deleting file: " & oops.Message
& vbNewLine & oops.Source & oops.HelpLink, "Error")
End Try
End If
End Sub
please someone give me some advice, thanks..
mscorlib.dll
Additional information: The process cannot access the file
"c:\Fax\524b2cfa00.tif" because it is being used by another process.
Tried..
File.Delete(curfax)
Kill(curfax)
oFileInfo = New System.IO.FileInfo(curfax)
oFileInfo.Delete()
i loaded the file into a picbox and then read the name of the file and path into a listbox. I'm setting the picbox to nothing, and deleting the file based on selected item.
this is my code for getting rid of it...
Dim movefax, curfax As String
Dim fi As New FileInfo(fswFaxWatcher.Path & "\" &
lstFaxes.SelectedItem.ToString)
curfax = fswFaxWatcher.Path & "\" & lstFaxes.SelectedItem
movefax = fswFaxWatcher.Path & "\Archive\" &
lstFaxes.SelectedItem
If File.Exists(movefax) Then
'MsgBox("Files Already Exists, Deleting Old File.",
MsgBoxStyle.Critical)
File.Delete(movefax)
End If
fi.CopyTo(movefax)
movefax = Nothing
lstFaxes.Items.Remove(lstFaxes.SelectedItem)
lstFaxes.ClearSelected()
picFax.Image = Nothing
picFax.Height = 0
picFax.Width = 0
If MessageBox.Show("Delete the selected files (files will be
permanently deleted)?", "Confirm Delete", MessageBoxButtons.OKCancel,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly) = DialogResult.OK Then
Dim delfile As System.IO.FileInfo
Try
delfile = New System.IO.FileInfo(curfax)
delfile.Delete()
Catch oops As Exception
MessageBox.Show("Error deleting file: " & oops.Message
& vbNewLine & oops.Source & oops.HelpLink, "Error")
End Try
End If
End Sub
please someone give me some advice, thanks..