Problem reading registry value

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<pre class="prettyprint lang-vb Dim readValue = My.Computer.Registry.GetValue("HKLMSOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstallMyApp", "InstallLocation", Nothing)[/code]
My code above is attempting to read the value that is specified at#HKLMSOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstallMyApp
at this location I have multiple entries. I want to read the contents of InstallLocation reg_sz c:program filesxxxx etc..

However everytime I run the code I get an exception
<pre class="prettyprint System.InvalidOperationException was unhandled
Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Registry key name must start with a valid base key name.
Source=RadarBox-Resources
StackTrace:
at RadarBox_Resources.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at RadarBox_Resources.My.MyProject.MyForms.get_Form1()
at RadarBox_Resources.My.MyApplication.OnCreateMainForm() in C:UsersxDesktopxxxxxxxxxMy ProjectApplication.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at RadarBox_Resources.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ArgumentException
Message=Registry key name must start with a valid base key name.
Source=mscorlib
StackTrace:
at Microsoft.Win32.Registry.GetBaseKeyFromKeyName(String keyName, String& subKeyName)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at Microsoft.VisualBasic.MyServices.RegistryProxy.GetValue(String keyName, String valueName, Object defaultValue)
at RadarBox_Resources.Form1..ctor() in C:UsersxDesktopxxxxxxxx-ResourcesForm1.vb:line 12
InnerException:
[/code]
<pre class="prettyprint" style="font-size:12px Im sure it a simple error but any help is appreciated. Thanks.[/code]
<br/>
<br/>
<br/>
<br/>

View the full article
 
Back
Top