0

Hey!

I'm trying to create a app that will add some reg keys. But I need to change the default value. How can I do it? I don't work :@

Imports Microsoft.Win32

Public Class Form1

    Dim regstr As RegistryKey = Registry.ClassesRoot

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        regstr.OpenSubKey("*\shell", True)
        regstr.CreateSubKey("*\shell\runas")
        regstr.SetValue("@", "Should be the default value")

    End Sub
End Class

Thanks!

1
Contributor
2
Replies
3
Views
6 Years
Discussion Span
Last Post by RenanLazarotto
0

Nice. Got it working. Now I'm with another trouble:

Imports Microsoft.Win32

Public Class Form1

    Dim regstr As RegistryKey = Registry.ClassesRoot
    Dim subregstr As RegistryKey

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        subregstr = regstr.OpenSubKey("*\shell\runas", True)
        subregstr.CreateSubKey("runas")
        subregstr.SetValue("", "Value")
    End Sub
End Class

The new value should be inside the 'runas' sub key, but it is not. What I did wrong? =(

0

nevermind. found the problem:

subregstr = regstr.OpenSubKey("*\shell", True)
            subregstr.CreateSubKey("runas")
            subregstr = regstr.OpenSubKey("*\shell\runas", True)
            subregstr.SetValue("", "Tornar-se proprietário")
            subregstr.SetValue("NoWorkingDirectory", "")
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.