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
Jihen Arem
NA
6
6.9k
C# and unable to close pdf Files methods Load() & Dispose()
Apr 23 2014 11:38 AM
I have a list of pdf files in my listBox, I want to use dispose() to release ressources of the system and delete my pdf files in my directory. but I can not and it throw me an exception when I load the file
An unhandled exception of type 'System.Runtime.InteropServices.InvalidComObjectException' occurred in AxInterop.AcroPDFLib.dll
Additional information: COM object that has been separated from its underlying RCW cannot be used.
void MonMouseClick(object sender, MouseEventArgs e)
{
if (lstDoc.SelectedItem != null)
{
axAcroPDF.LoadFile(lstDoc.SelectedItem.ToString());
}
}
void DeleteFiles(string Rep)
{
axAcroPDF.Dispose();
Array.ForEach(Directory.GetFiles(Rep), File.Delete);
}
private void Form1_Load(object sender, EventArgs e)
{
DeleteFiles(@"c:\\Temp2");
}
Please Any Help Or Suggestions! Thanks!
Reply
Answers (
2
)
Retrive image from database using c#
How to get Session values in Global.asax?