?
Solved

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

Posted on 2006-07-21
2
Medium Priority
?
1,276 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 1000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

809 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