regedit is just a program to access the "Windows Registry" aka a big database of settings.
vb.net has a class to access / modify the registry. You have to learn how to use the class .net gives you.
Accessing the Registry with Visual Basic .NET
Code:
Imports Microsoft.Win32
Dim regVersion As RegistryKey
Dim keyValue As String
keyValue = Software\\Microsoft\\TestApp\\1.0
regVersion = Registry.CurrentUser.OpenSubKey(keyValue, False)
Dim intVersion As Integer = 0
If (Not regVersion Is Nothing) Then
intVersion = regVersion.GetValue("Version", 0)
regVersion.Close()
End If
But I'm not going to explain how to use the class.
apparently
Code:
Dim has As String
has = My.Computer.Registry.CurrentUser.GetValue("PATH", "thisone", Nothing)
Textbox1.Text = ha
apparently you're not passing in the correct arguments / the path doesn't exist. This new .net class for accessing the registry is pretty straight forward. Get a value, Set a value.
Also, Getvalue() returns an Object, so setting ha = an object, is a little weird and a sign the code has a problem. It's calling .ToString() on the object automatically, but that may not be what you want/expect.
The function has 3 overloads.
(name As
String)
(name As
String, defaultValue as
Object)
(name, defaultvalue, options As
Microsoft.Win32.RegistryValueOptions)
You are passing in 3 arguments (string, string, nothing). I think this is incorrect.
If "name" is not found, "defaultValue" will be returned. Which I think is happening in your case? You're not telling the registry WHICH exact key/data pairs you want. You have to define "path" better / in a different way.
You pass in a string: "thisone", where it expects an 'Object' -- red flag.
-------
they did it slightly differently (using more classes / objects), but the microsoft code uses
Dim keyValue As String
keyValue = Software\\Microsoft\\TestApp\\1.0
software\microsoft\TestApp <-- is where in the registry database this data is located. Where is your "PATH" supposed to be pointing to?
---------- Post added at 08:02 AM ---------- Previous post was at 07:36 AM ----------
edit: OP, use the [ img ] [ /img ] and [ code ] [ / code] tags plz : not fun having to open 4 tabs just to see what your code is etc.