?
Solved

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

Posted on 2006-07-21
2
Medium Priority
?
1,270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 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