Solved

out of memory error

Posted on 2010-11-16
5
482 Views
Last Modified: 2012-05-10
I am trying to import a file and view it but I am getting the error "out of memory".   It is a PDF file 68k in size.

My code is below.

Thanks for the help
Connection1.Close()
        Connection1.Open()
        Me.OpenFileDialog1.FileName = "*.*"
        If (Me.OpenFileDialog1.ShowDialog() = DialogResult.OK) Then

            'copy file to bc-biztalk
            currentfilename = OpenFileDialog1.FileName
            filenamepos = InStrRev(currentfilename, "\")
 
                 TextBox1.Text = currentfilename
>> ERROR HERE >> PictureBox1.Image = Image.FromFile(TextBox1.Text)
                 PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage

Open in new window

0
Comment
Question by:running32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 34147260
You cannot open PDF files in a picturebox, only pictures.  That is the reason for the error.
0
 

Author Comment

by:running32
ID: 34147425
What can I display  a PDF file in?  Thanks
0
 
LVL 32

Expert Comment

by:Erick37
ID: 34147485
Assuming that you have Acrobat installed on the client machine, you could use the WebBrowser control to display PDF's
0
 

Author Comment

by:running32
ID: 34147556
I added the Acrobat reader to my form and put the code in

 AxAcroPDF1.LoadFile(currentfilename)  \ path = currentfilename.  c:\test.pdf

but it will not display in my windows form.  
0
 
LVL 32

Expert Comment

by:Erick37
ID: 34147657
Use the WebBrowser control and navigate to your PDF file:

WebBrowser1.Navigate("c:\test.pdf")
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question