Solved

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

Posted on 2006-07-21
2
1,266 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

856 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