Solved

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

Posted on 2006-07-21
2
1,263 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now