VB.Net实现开机启动程序

前端之家收集整理的这篇文章主要介绍了VB.Net实现开机启动程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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

猜你在找的VB相关文章