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.
NevSoFlyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
nayernaguibConnect With a Mentor Commented:
I tried the code with Acrobat Reader 8. You need to change the code into the following (which is somehow surprising!):

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

______________

  Nayer Naguib
0
 
nayernaguibCommented:
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
0
 
NevSoFlyAuthor Commented:
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
0
 
NevSoFlyAuthor Commented:
many thanks,  I look forward to your replies on my future questions, LOL
0
All Courses

From novice to tech pro — start learning today.