Link to home
Start Free TrialLog in
Avatar of NevSoFly
NevSoFly

asked on

Can't dispay pdf file in a child form of an MDI application.

I have a vb.net 2005 MDI application where I am displaying a pdf file on a form using an AxAcroPDF1 control.  This works great until I make the form a child form by adding the following line to the load event of the form:

Me.MdiParent=frmMother (Mother being the parent form).

When I do this the PDF file is not displayed.  I am using Acrobat Reader 8.  I do not want to use the webcontrol or an older version of Acrobat Reader because they are much slower than Acrobat Reader 8.

I can't find anything on the web and at this point I'm clueless about how to proceed.  Any and all help is welcome.
Avatar of nayernaguib
nayernaguib
Flag of Egypt image

I read the following post (which is over two years old), that discusses the same problem with Acrobat Reader version 7.0:

  http://www.vbforums.com/archive/index.php/t-330213.html

One interesting thing is that the author mentioned is that clicking the button for a second time loads the PDF file, so I tried the following "trick", and it worked (I have VB.NET 2005 and Acrobat Reader 7.0):

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.MdiParent = MDIParent1
        Try
            AxAcroPDF1.LoadFile("c:\somefile.pdf")
        Catch
        End Try
        Try
            AxAcroPDF1.LoadFile("c:\somefile.pdf")
        Catch
        End Try
    End Sub

Of course I have no idea why the first call to LoadFile() throws an exception. :)

______________

  Nayer Naguib
Avatar of NevSoFly
NevSoFly

ASKER

Thanks for the reply but it didn't work.

The code:
AxAcroPDF1.LoadFile("c:\somefile.pdf")
does not throw an exception but at the same time I get nothing in the AzAcroPDF control.  I tried your code and some modifications of it.  I am using Acrobat Reader 8.01.  Do you know of any Acrobat/VB forums that I can quey
ASKER CERTIFIED SOLUTION
Avatar of nayernaguib
nayernaguib
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
many thanks,  I look forward to your replies on my future questions, LOL