0

I'm trying to follow a tutorial but I keep getting the warning:

Name 'AdobeReader' is not declared

Can sombody tell me what is wrong? The tutorial is found here, and I'm trying out Answer 2 from that page, which says:

Here is another way to read pdfs.

Right click on any of the tabs in your toolbox and click choose items.(Just make sure you have a version of adobe reader installed before starting.) When the dialog box pops up click the 'com components' tab then pick tha 'adobe pdf reader' com component. Click ok and you should now see a 'adobe pdf reader' control in your toolbox. Click this and drag it to your vb form.(you may need to resize it, usually appears very small). Now in order to read any pdf just alter the 'src' property of the control either in code or in the designer. when you run the program you should be able to view the pdf doc in the vb form with most of the options you get in adobe reader. Here is how you would alter the 'src' property in code.

PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load 
    AdobeReader.src = "C:\mydoc.pdf"
End Sub
Kara
  • 6,115
  • 16
  • 50
  • 57
LabRat
  • 1,996
  • 11
  • 56
  • 91
  • Did you successfully place the adobe reader control on your form? If so, what did you name it? – Steven Doggart Feb 19 '13 at 13:45
  • Yeah i did sucessfully place the readers control on the form and left its orriginal name which is AxAcroPDF1 – LabRat Feb 19 '13 at 14:06
  • Try changing that line in the code, then, from `AdobeReader.scr = ...` to `AxAcroPDF1.src = ...` I assume that's supposed to be the control name and the tutorial didn't properly specify that. – Steven Doggart Feb 19 '13 at 14:08

1 Answers1

2

If I´m getting your Question right, you just want to open a PDF-File. Simply call:

Process.Start("Path/To/MyPdfFile.pdf")
makim
  • 3,154
  • 4
  • 30
  • 49
  • That would simply launch a separate application to load the PDF. It wouldn't load it into a control on the form. – Steven Doggart Feb 19 '13 at 13:51
  • That may be the case, it's hard to say given the way the question is written. It's not a bad answer, I just thought I should clarify that it would do the same thing, but in a very different way. – Steven Doggart Feb 19 '13 at 13:54
  • Yeah and i can add it ussing a webbrowser too but this dosnt meet my expectation either (the web browser method is slow) – LabRat Feb 19 '13 at 14:07