• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

out of memory error

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
running32
Asked:
running32
  • 3
  • 2
1 Solution
 
Erick37Commented:
You cannot open PDF files in a picturebox, only pictures.  That is the reason for the error.
0
 
running32Author Commented:
What can I display  a PDF file in?  Thanks
0
 
Erick37Commented:
Assuming that you have Acrobat installed on the client machine, you could use the WebBrowser control to display PDF's
0
 
running32Author Commented:
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
 
Erick37Commented:
Use the WebBrowser control and navigate to your PDF file:

WebBrowser1.Navigate("c:\test.pdf")
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now