Imports Microsoft.Win32 Public Class Form1 Dim regKey As RegistryKey 'Makes the key Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click regKey = Registry.LocalMachine.OpenSubKey("Software", True) regKey.CreateSubKey("MyAppV2") regKey.Close() End Sub 'Delete the key Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click regKey = Registry.LocalMachine.OpenSubKey("Software", True) regKey.DeleteSubKey("MyAppV", True) regKey.Close() End Sub 'Read/write from key: Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim ver As Decimal regKey = Registry.LocalMachine.OpenSubKey("Software\MyAppV", True) ' regKey.SetValue("AppName", "MyRegApp") ver = regKey.GetValue("Version", 0.0) If ver < 1.1 Then regKey.SetValue("Version", 1.1) regKey.Close() End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)