473,466 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Object reference not set to an instance of an object (PDF Reader O

I have placed an ActiveX PDF control (the Adobe Reader OCX) on a .Net Windows
form and manually set the "src" property to "c:\myfolder\1234.PDF". The
control displays this file when the application is run. So far so good.

However, when I add a button to change the src file (to be displayed) with a
single line of code in the button click event as shown below:

AxPdf1.src = "c:\myfolder\1235.PDF"

....I get the following error:

An unhandled exception of type 'System.NullReferenceException' occurred in
mscorlib.dll

Additional information: Object reference not set to an instance of an object.
So what am I doing wrong?
--
Andy, MCDBA
Nov 21 '05 #1
1 1939
If you look in debug you will probably notice that AxPdf1 is set to a value
of nothing. You need to instantiate it with a line like
AxPdf1 = New ........ Normally this is taken care of by placing the OCX on
the form. Step through the code to see if it ever has a value and if it
loses it somewhere.

Hope this helps some.
Chris


"Andy A38" <An*****@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
I have placed an ActiveX PDF control (the Adobe Reader OCX) on a .Net
Windows
form and manually set the "src" property to "c:\myfolder\1234.PDF". The
control displays this file when the application is run. So far so good.

However, when I add a button to change the src file (to be displayed) with
a
single line of code in the button click event as shown below:

AxPdf1.src = "c:\myfolder\1235.PDF"

...I get the following error:

An unhandled exception of type 'System.NullReferenceException' occurred in
mscorlib.dll

Additional information: Object reference not set to an instance of an
object.
So what am I doing wrong?
--
Andy, MCDBA

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: monkey king | last post by:
I have a given dll file(PDFCreator.dll) - probably generated by VC++. I want to use its method(PDFCreator()) in dotNet environment. It works well in WindiowsApplication, but bad in WebApplication...
8
by: Chris | last post by:
Hello all, I wish to automate printing of PDF documents in a C# application. Is there an Adobe .net object? I tried to create a reference to the COM Object Adobe Type Library, but I get error...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
2
by: Anonymous | last post by:
Hello, I have some code which simply reads a RSS with the XmlTextReader and XmlDocument. Unfortunaly I get the error: Object reference not set to an instance of an object. Here is my simple...
3
by: Tom | last post by:
Hi, I built a C# web application, all things are ok when i test locally. I deploy it to a remote server. I set <customErrors mode="Off" /> in web.config. One of the aspx page has the problem...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
6
by: Alec MacLean | last post by:
Hi, I've created a small application for our company extranet (staff bulletins) that outputs a list of links to PDF's that are stored in a SQL table. The user clicks a link and the PDF is...
17
by: krishnakant Mane | last post by:
hello all, I am stuck with a strange requirement. I need a library that can help me display a pdf file as a report and also want a way to print the same pdf file in a platform independent way....
0
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i work on winxp with Net2 ver 2.0.50727 in the IIS (under ASP.NET) in my web.config file i have : <configuration> <connectionStrings> <add name="local_con" connectionString="Data...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.