Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click Dim Reg As Microsoft.Win32.RegistryKey Reg = Microsoft.Win32.Registry.CurrentUser Reg.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run",True) Reg.SetValue("MB",Application.ExecutablePath)'写入注册表 Reg.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click Dim Reg As Microsoft.Win32.RegistryKey Reg = Microsoft.Win32.Registry.CurrentUser Reg.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run",True) Reg.Deletue("MB")'删除注册表键 Reg.Close() End Sub