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!

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? =(

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", "")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.