Solved

91 Object reference not set to an instance of an object.

Posted on 2006-07-21
2
1,267 Views
Last Modified: 2008-02-01
Hi,

On my devolopment machine the following code works fine however when I create a setup file and deploy this app to another computer It throws an error.

I was wondering if someone could tell me why the error "91 Object reference not set to an instance of an object" is thrown from the following code and how I might be able to work around this issue.

         Dim strDatabaseLocation as string

        'get database location
        Dim dbLocation As Microsoft.Win32.RegistryKey

        dbLocation = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Bussiness\\Product", False)
        strDatabaseLocation = dbLocation.GetValue("Database location")
        dbLocation.Close()

Any help would really be appreaciated!

Thanks
0
Comment
Question by:mike_allain
2 Comments
 
LVL 6

Accepted Solution

by:
manch earned 250 total points
ID: 17158966

The problem is u have not created the Registry key on the machine where u r deploying the code.

Check for the Key - SOFTWARE\\Bussiness\\Product
and Text u r opening - dbLocation.GetValue("Database location")

0
 

Author Comment

by:mike_allain
ID: 17159749
Thanks Manch,

The funny thing is I checked , and checked and I was sure it was not that but after reading your post (And a good nights sleep) I checked again and I had a typeO.....

Grrr..... :)

Thansk again

Mike
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question