Solved

out of memory error

Posted on 2010-11-16
5
479 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
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio - "Windows Form Designer generated code" 2 51
Visual Studio 2013 Shortcut (VB) 4 46
Crystal reports vb.net 2 41
VB.NET (2008) - Refactoring Question 2 21
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…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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