Avatar of running32
running32
 asked on

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

Visual Basic.NET

Avatar of undefined
Last Comment
Erick37

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Erick37

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
running32

ASKER
What can I display  a PDF file in?  Thanks
Erick37

Assuming that you have Acrobat installed on the client machine, you could use the WebBrowser control to display PDF's
running32

ASKER
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.  
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Erick37

Use the WebBrowser control and navigate to your PDF file:

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