Error while writing to the registry... OpenSubKey / SetValue

R

Richard Thornley

Hello,

I am working on a VB.Net application and I am getting an error ONLY on the
main computer that uses the application. The main computer is on the other
coast so of course it would be the one having the problem. The application
works fine on the test computers in my office. The test computers are all
running Windows XP Service Pack 2. (Now that I wrote that I should check
the version of Windows XP on the main computer.)

Here is my code...

Private Sub WriteRegistryKey()

MessageBox.Show("WriteRegistryKey Begin")

Dim keyLapTopLocation As Microsoft.Win32.RegistryKey
Dim keyDeskTopLocation As Microsoft.Win32.RegistryKey

MessageBox.Show("WriteRegistryKey Step 1") <-- This message was
displayed

keyLapTopLocation =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ConverseDBMS", True)
<--error is in this line or the next
keyLapTopLocation.SetValue("LaptopLocation", editLaptopLocation.Text)

MessageBox.Show("WriteRegistryKey Step 2") <-- error occured before
this message displayed

keyDeskTopLocation =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ConverseDBMS", True)
keyDeskTopLocation.SetValue("DesktopLocation", editDesktopLocation.Text)

MessageBox.Show("WriteRegistryKey End")

End Sub

Since the main computer using the application is on the other coast I did a
very low-tech thing and included some messageboxes in the code to try to
isolate the offending code. The "step 1" messagebox displayed but the "step
2" messagebox did not display. So that puts the error in the code between
those two messageboxes.

The error displayed is...

An unhandled exception has occured in your application.
Object reference not set to an instance of an object

Below is the "Exception Text" from the "details" button of the error dialog.

Any help with this issue would be greatly appreciated.

Cheers,
Richard

************** Exception Text **************

System.NullReferenceException: Object reference not set to an instance of an
object.

at conversedbms.frmSynchronize.WriteRegistryKey()

at conversedbms.frmSynchronize.btnSynchronize_Click(Object sender,
EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)





************** Loaded Assemblies **************

mscorlib

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll

----------------------------------------

conversedbms

Assembly Version: 1.0.1832.29608

Win32 Version: 1.0.1832.29608

CodeBase: file:///C:/Program%20Files/ConverseDB/conversedbms_debug.exe

----------------------------------------

System.Data

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll

----------------------------------------

System

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll

----------------------------------------

System.Windows.Forms

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll

----------------------------------------

System.Drawing

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll

----------------------------------------

Infragistics.Win.UltraWinStatusBar.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinStatusBar.v4.3.DLL

----------------------------------------

Infragistics.Win.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.v4.3.DLL

----------------------------------------

Infragistics.Shared.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Shared.v4.3.DLL

----------------------------------------

Microsoft.VisualBasic

Assembly Version: 7.0.5000.0

Win32 Version: 7.10.6001.4

CodeBase:
file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll

----------------------------------------

Infragistics.Win.UltraWinGrid.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinGrid.v4.3.DLL

----------------------------------------

System.Xml

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll

----------------------------------------

Infragistics.Win.UltraWinTabControl.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinTabControl.v4.3.DLL

----------------------------------------

Infragistics.Win.UltraWinEditors.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinEditors.v4.3.DLL

----------------------------------------

Accessibility

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.573

CodeBase:
file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll

----------------------------------------

Infragistics.Win.UltraWinDataSource.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinDataSource.v4.3.DLL

----------------------------------------
 
S

Scott Gunn

Found it.

You need to create the key "ConverseDBMS" before you can reference it.

Regards
Scott

Scott Gunn said:
Crashes on my PC too.

Will take a quick look for you

Regards
Scott.

Richard Thornley said:
Hello,

I am working on a VB.Net application and I am getting an error ONLY on the
main computer that uses the application. The main computer is on the other
coast so of course it would be the one having the problem. The application
works fine on the test computers in my office. The test computers are all
running Windows XP Service Pack 2. (Now that I wrote that I should check
the version of Windows XP on the main computer.)

Here is my code...

Private Sub WriteRegistryKey()

MessageBox.Show("WriteRegistryKey Begin")

Dim keyLapTopLocation As Microsoft.Win32.RegistryKey
Dim keyDeskTopLocation As Microsoft.Win32.RegistryKey

MessageBox.Show("WriteRegistryKey Step 1") <-- This message was
displayed

keyLapTopLocation =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ConverseDBMS", True)
<--error is in this line or the next
keyLapTopLocation.SetValue("LaptopLocation", editLaptopLocation.Text)

MessageBox.Show("WriteRegistryKey Step 2") <-- error occured before
this message displayed

keyDeskTopLocation =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ConverseDBMS", True)
keyDeskTopLocation.SetValue("DesktopLocation", editDesktopLocation.Text)

MessageBox.Show("WriteRegistryKey End")

End Sub

Since the main computer using the application is on the other coast I
did
a
very low-tech thing and included some messageboxes in the code to try to
isolate the offending code. The "step 1" messagebox displayed but the "step
2" messagebox did not display. So that puts the error in the code between
those two messageboxes.

The error displayed is...

An unhandled exception has occured in your application.
Object reference not set to an instance of an object

Below is the "Exception Text" from the "details" button of the error dialog.

Any help with this issue would be greatly appreciated.

Cheers,
Richard

************** Exception Text **************

System.NullReferenceException: Object reference not set to an instance
of
an
object.

at conversedbms.frmSynchronize.WriteRegistryKey()

at conversedbms.frmSynchronize.btnSynchronize_Click(Object sender,
EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ButtonBase.WndProc(Message& m)

at System.Windows.Forms.Button.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)





************** Loaded Assemblies **************

mscorlib

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll

----------------------------------------

conversedbms

Assembly Version: 1.0.1832.29608

Win32 Version: 1.0.1832.29608

CodeBase: file:///C:/Program%20Files/ConverseDB/conversedbms_debug.exe

----------------------------------------

System.Data

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/sys
tem.data.dll

----------------------------------------

System

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.d
ll

----------------------------------------

System.Windows.Forms

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c56193
4e089/system.windows.forms.dll

----------------------------------------

System.Drawing

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/
system.drawing.dll

----------------------------------------

Infragistics.Win.UltraWinStatusBar.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinStatusBar.v4.
3.DLL

----------------------------------------

Infragistics.Win.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.v4.3.DLL

----------------------------------------

Infragistics.Shared.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Shared.v4.3.DLL

----------------------------------------

Microsoft.VisualBasic

Assembly Version: 7.0.5000.0

Win32 Version: 7.10.6001.4

CodeBase:
file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11
d50a3a/microsoft.visualbasic.dll

----------------------------------------

Infragistics.Win.UltraWinGrid.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinGrid.v4.3.DLL
----------------------------------------

System.Xml

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/syst
em.xml.dll

----------------------------------------

Infragistics.Win.UltraWinTabControl.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinTabControl.v4
.3.DLL

----------------------------------------

Infragistics.Win.UltraWinEditors.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinEditors.v4.3.
DLL

----------------------------------------

Accessibility

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.573

CodeBase:
file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/a
ccessibility.dll

----------------------------------------

Infragistics.Win.UltraWinDataSource.v4.3

Assembly Version: 4.3.20043.27

Win32 Version: 4.3.20043.27

CodeBase:
file:///C:/Program%20Files/ConverseDB/Infragistics.Win.UltraWinDataSource.v4
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top