# Visual Basic > Visual Basic .NET > VS 2022 [RESOLVED] Adobe Reader Control

## sacramento

Hi to all,

When i try to put a Adobe PDF Reader on my Windows.Form i get this error:



Any help to resolve the problem

Thanks

----------


## jmcilhinney

Please don't post pictures of text. Post text. We can't copy text from a picture. It appears that you have, once again, captured much more of the screen than necessary and this site has resized your image and made the text hard to read.

As for the issue, the output you have posted provides some specific instructions as to what a next step could be. What have you done about that?

----------


## sacramento

> Please don't post pictures of text. Post text. We can't copy text from a picture. It appears that you have, once again, captured much more of the screen than necessary and this site has resized your image and made the text hard to read.
> 
> As for the issue, the output you have posted provides some specific instructions as to what a next step could be. What have you done about that?



Hi...sory once more...in fact i had done nothing, because, sincerelly, i don't know what i can do

The Error says:

"Failed to create component 'AxHost'.The error message
follows:
'System.Reflection.Reflectiontypeloadexception:Unable to
load one or more of the requested types. Retrieve the 
loaderexceptions property for more information.
at
System.Windows.form.design.documentdesigner.Axtoolboxl
tem.CreateComponentsCore(iDesignerHost host)
at
System.Drawing.Design.ToolBoxItem.CreateComponentsCore(l
DesignerHost host, IDictionary default values)
at
System.Drawing.Design.ToolBoxItem.CreateComponentsCore(lDesi
gnerHost host, IDictionary default values)
at
System.Windows.form.design.OleDragDropHandler.Createto
ol(ToolBoxItem tool, Control Parent, Int32 x, Int32 y, Int32
widht, Int32 height, Boolean haslocation, Bolean hassize,
ToolBoxSnapDragDropEventsArgs e)'

----------


## jmcilhinney

> The Error says:
> 
> Retrieve the 
> loaderexceptions property for more information.


Have you done that or made any effort to find out how to do that? Have you, for instance, typed "loaderexceptions property" into a search engine?

----------


## sacramento

> Have you done that or made any effort to find out how to do that? Have you, for instance, typed "loaderexceptions property" into a search engine?


Yes, and i had find a lot of things but notthing illuminating ( or maybe i don't understand very well), that's why i had post here

----------


## Peter Porter

> Originally Posted by jmcilhinney
> 
> 
> Have you done that or made any effort to find out how to do that? Have you, for instance, typed "loaderexceptions property" into a search engine?
> 
> 
> Yes, and i had find a lot of things but notthing illuminating ( or maybe i don't understand very well), that's why i had post here


Doing what JMC suggested, but adding VB to it "loaderexceptions property vb" I found plenty of examples on how to solve this problem. I also found C# examples that can be easily converted to VB. If you don't understand anything provided by search results, you wont be able to understand what we provide here.

What is your exact process in adding Adobe's PDF Reader to the form? Have you searched for instructions on how to do this?

----------


## sacramento

> Doing what JMC suggested, but adding VB to it "loaderexceptions property vb" I found plenty of examples on how solve this problem. I also found C# examples that can be easily converted to VB. If you don't understand anything provided by search results, you wont be able to understand what we provide here.
> 
> What is your exact process in adding Adobe's PDF Reader to the form? Have you searched for instructions on how to do this?


The code that i have is the beginning of a new form, in the project, that i would like to insert the "Adobe PDF Reader", and in the design form, when i add the component give the error that i had mentioned...I have no code yet but this is the code:



```
Imports System.IO
Imports System
Imports System.Data
Imports System.Data.DataTable
Imports System.Data.SqlClient
Imports System.Windows.Forms
Imports System.Data.OleDb

Public Class Medicamentos
    Private Sub Medicamentos_Load(sender As Object, e As EventArgs) Handles MyBase.Load




    End Sub
End Class
```

----------


## sacramento

I had found this code, but sory my Unknowledge where i put it? And is the right code?



```
Try
        Catch ex As Exception
            If TypeOf ex Is System.Reflection.ReflectionTypeLoadException Then
                Dim typeLoadException = TryCast(ex, ReflectionTypeLoadException)
                Dim loaderExceptions = typeLoadException.LoaderExceptions
            End If
        End Try
```

----------


## sacramento

> =What is your exact process in adding Adobe's PDF Reader to the form? Have you searched for instructions on how to do this?


Simply (I think)...the component are in the Toolbox and i put it in the design form

----------


## Peter Porter

So when you add the Adobe PDF Reader from the toolbox to the form you get an error?

It works for me when I add the reader and run the form without code. Is this the same 2008 project, or a new one in VS 2022?

----------


## sacramento

> So when you add the Adobe PDF Reader from the toolbox to the form you get an error?
> 
> It works for me when I add the reader and run the form without code. Is this the same 2008 project, or a new one in VS 2022?



Yes I get the error that i had post here...Yes is the same project that i had convert from 2008 to 2022

----------


## Peter Porter

> Yes I get the error that i had post here...Yes is the same project that i had convert from 2008 to 2022


Try this... Create a new test project with the same framework as your 2008 project. Add the Adobe PDF Reader to your toolbox like before. Drag the Adobe PDF Reader from the toolbox to your empty form (don't dock it) and press play. You should see a dark gray square which is the PDF reader.

If it still doesn't work in the test project, explain to me in great detail exactly what you've done.

Reading all that you wrote before seems like you know how to put the Adobe PDF Reader in the toolbox, so I assume you see it in there, and can drag it to the form.

----------


## sacramento

> Try this... Create a new test project with the same framework as your 2008 project. Add the Adobe PDF Reader to your toolbox like before. Drag the Adobe PDF Reader from the toolbox to your empty form (don't dock it) and press play. You should see a dark gray square which is the PDF reader.
> 
> If it still doesn't work in the test project, explain to me in great detail exactly what you've done.
> 
> Reading all that you wrote before seems like you know how to put the Adobe PDF Reader in the toolbox, so I assume you see it in there, and can drag it to the form.


Hi...thanks for your reply.
I had made that you had say, but unfornutely i don't have good news to see:
1 - WHen i start a new project in VS2022 the framework for choose is only 6.0 or 7.0
2 - If i try to change to ohter framework after create the project in the option where we see the framework that we have install or for install, i have 3.0 and 3.1 5.0 and 7.0 options.
3 - When i add the "Adove PDF reader" too the toolbox the Toolbox project don't present it, and these way i can't drag the Adobe PDF reader for the project

And that's it...sory i don't know what can i do more

----------


## Peter Porter

Forget about the new project and go back to the 2008 one. Is the 2008 project opened in Visual Studio 2022? If it is, click "My Project" to see if the 2008 project's framework was upgraded to a newer one. If so, what framework do you see?

I don't have VS 2022, and I don't have access to my VS 2019 installation right now, but you should be able to add the PDF Reader to the toolbox. Following my instructions, place your mouse anywhere inside the toolbox under "_All Windows Forms_", and right-click it with your mouse button. In the menu that appears, click "Choose Items". In the _Toolbox Items_ pop-up window, click the "_COM_" components tab. You should now see Adobe PDF Reader at the top. Check the box next to it and click OK. The Adobe PDF Reader should now be showing in your toolbox under "_All Windows Forms_".

Um... do you have the Adobe PDF Reader installed on your computer? What I mean by installed, have you downloaded it from the Adobe website and installed it?

----------


## sacramento

Hi Peter,



> Is the 2008 project opened in Visual Studio 2022? If it is, click "My Project" to see if the 2008 project's framework was upgraded to a newer one. If so, what framework do you see?


NO...the framework is the same on VS2022...in this case 3.5, that's the framework i use in VS2008





> I don't have VS 2022, and I don't have access to my VS 2019 installation right now, but you should be able to add the PDF Reader to the toolbox. Following my instructions, place your mouse anywhere inside the toolbox under "All Windows Forms", and right-click it with your mouse button. In the menu that appears, click "Choose Items". In the Toolbox Items pop-up window, click the "COM" components tab. You should now see Adobe PDF Reader at the top. Check the box next to it and click OK. The Adobe PDF Reader should now be showing in your toolbox under "All Windows Forms".


Peter sory but maybe you don't had read very well my post...The component was added a long time ago to the project, the problem is that when it opens inside the form it generates the error that I already posted here.




> Um... do you have the Adobe PDF Reader installed on your computer? What I mean by installed, have you downloaded it from the Adobe website and installed it?


Yes off course


Information with tests:
1 - I' had open a new project in VS2022, but this time a Project "Windows Form App(.Net Framework)" and i had choose 4.8 Framework.
2 - I had add the Component "ADOBE PDF READER" and the component was added to the form without errors.
3 - Then I try to add only this form to my Project (that i had convert from 2008 to 2022) and get this error:

----------


## Peter Porter

> 1 - I' had open a new project in VS2022, but this time a Project "Windows Form App(.Net Framework)" and i had choose 4.8 Framework.
> 2 - I had add the Component "ADOBE PDF READER" and the component was added to the form without errors.
> 3 - Then I try to add only this form to my Project (that i had convert from 2008 to 2022) and get this error:


Omg! I never told you to paste a new projects form with the PDF Reader into the old 2008 project! Also, think about it... A form and control built under a higher framework wont work if you copy and paste it to an old project with an old framework. Moving the form doesn't move the required dlls for the control on it, that's why you're getting this new error. The DLLs for that version of the control are missing, and it wont work with DLLs from an old control if the version is not the same, or if the old control's DLLs is corrupt.

What you suppose to do is perform my instructions in the 2008 project in VS 2022 to add the PDF Reader. That's it!

If the old version of PDF Reader control doesn't work in the 2008 project in VS 2022, then you need to delete that old PDF control from the project, meaning delete it from the form, delete it from the toolbox, and delete it's old AcroPDFLib dlls in all subfolders of the bin and obj folders. You then clean and rebuild the old project and follow my instructions to re-add the PDF Reader to it's toolbox.

Your reply to my instructions to add the PDF reader doesn't make sense:




> Originally Posted by Peter Porter
> 
> 
> I don't have VS 2022, and I don't have access to my VS 2019 installation right now, but you should be able to add the PDF Reader to the toolbox. Following my instructions, place your mouse anywhere inside the toolbox under "_All Windows Forms_", and right-click it with your mouse button. In the menu that appears, click "Choose Items". In the _Toolbox Items_ pop-up window, click the "_COM_" components tab. You should now see Adobe PDF Reader at the top. Check the box next to it and click OK. The Adobe PDF Reader should now be showing in your toolbox under "_All Windows Forms_".
> 
> 
> Peter sory but maybe you don't had read very well my post...The component was added a long time ago to the project, the problem is that when it opens inside the form it generates the error that I already posted here.


What you wrote above is like telling a car mechanic that he doesn't understand the problem with your car after he explained to you how it could be fixed. Do you leave the defective part in your car arguing that it's been in there for a long time, but it's now causing problems, or do you have it replaced? I hope you wouldn't buy a new car for parts to fix a hoopty! The mechanics instructions didn't state to buy a new car to fix an old one, like I never told you to add a new project's form to the old project.





> The component was added a long time ago to the project,


Just delete the old PDF reader control from the old project's form and Toolbox, delete it's old DLLs, and perform my instructions in the 2008 project in VS 2022 to re-add a new PDF Reader to it, and then try adding it to the old projects form again, then clean, rebuild, and save the project. You might also have to exit the project (closing Visual Studio), and then open it again to get it to work. That was a quirk sometimes with older versions of VS, so if it happens with the newer one, just close and reopen VS, and the project should be fine.

If after performing my instructions in the 2008 project it still doesn't work, and the old project doesn't have to remain with framework 3.5, then updating your project's framework might solve the problem. But if it doesn't, you might have to completely delete and then Re-add the PDF Reader to the old project's newer framework.

Everything I wrote above only takes a couple of minutes to do.

----------


## sacramento

Hi Peter,

Finally the component has work.
Sory if i had no understand you, but english is not my native language in for times, in this kind of language (specific) i have sometimes difficult to understand.
I'm just an enthusiastic Programmer, and like you had view, i have some difficults.
Thanks a lot for the help

----------

