Solved

out of memory error

Posted on 2010-11-16
5
476 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
  • 3
  • 2
5 Comments
 
LVL 32

Accepted Solution

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

Author Comment

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

Expert Comment

by:Erick37
Comment Utility
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
Comment Utility
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
Comment Utility
Use the WebBrowser control and navigate to your PDF file:

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now