[2005] Get Registry Value
I am trying to setup a small function to get the version of the default internet browser. Here is my code:
VB Code:
Imports Microsoft.Win32
Imports System.Environment
Private Sub GetDefBrowser()
Dim DefBrowser As String
Dim IEVersion As String
DefBrowser = Registry.ClassesRoot.GetValue("HKEY_CLASSES_ROOT\HTTP\shell\open\command").ToString
IEVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(DefBrowser).ProductVersion.ToString()
Label1.text = IEVersion
end sub
I keep getting this error on the GetValue statement:
{"Object reference not set to an instance of an object."}
I have verified what is there in the registry:
(Default) REG_SZ "C:\Program Files\Internet Explorer\IEXPLORE.EXE" -nohome
What am i doing incorrectly or missing??
Thank you in advance,
Dminder
Re: [2005] Get Registry Value
VB Code:
DefBrowser = Registry.ClassesRoot.OpenSubKey("\HTTP\shell\open\command", False).GetValue("").ToString
that will get you the reg string, however you still need to parse it to remove any command line params that may be attached, like the -nohome part...