I am trying to save the text file in this path:\"C:\\Test\\test.txt\" and when the file is already opened I need to check whether the file is opened and I need to close it b
I was having this problem with a .csv file my program attaches to an email. I added code to clear the Attachments collection in the MailMessage object then disposing the MailMessage and Attachment objects after the mail is sent. That appears to have fixed the problem.