TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vidya Yadav
NA
59
0
Deleting File Through C# Program.
Oct 7 2009 12:42 AM
Hi,
In my application i am taking multiple image files from user using openfiledialog and display those image files in flowlayoutpanel. After pressing on Insert button i used to copy all those images in a folder (C:\Images). When there is no file exists the file get copied easily, but if it exists i delete the file, but while deleting file it shows error
"The process cannot access the file"C:\Images\xyz.jpg" because it is being used by another process"
The code i used is
if
(
File
.Exists(destFileName))
{
File
.Delete(destFileName);
File
.Copy(sourceFileName, destFileName);
}
else
File
.Copy(sourceFileName, destFileName);
Is it because i display the images in flowlayoutpanel while deleting. But before execting above code i clears all controls added in the flowlayoutpanel. Still the error occurs.. What should i do?
Regards,
Vidya
Reply
Answers (
2
)
DataAdapter.Fill() ending load code?
Creating Custom Data Tables?