VB.Net实现开机启动程序

前端之家收集整理的这篇文章主要介绍了VB.Net实现开机启动程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click
  2. Dim Reg As Microsoft.Win32.RegistryKey
  3.  
  4. Reg = Microsoft.Win32.Registry.CurrentUser
  5.  
  6. Reg.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run",True)
  7.  
  8. Reg.SetValue("MB",Application.ExecutablePath)'写入注册
  9.  
  10. Reg.Close()
  11.  
  12. End Sub
  13.  
  14.  
  15. Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click
  16.  
  17. Dim Reg As Microsoft.Win32.RegistryKey
  18.  
  19. Reg = Microsoft.Win32.Registry.CurrentUser
  20.  
  21. Reg.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run",True)
  22.  
  23. Reg.Deletue("MB")'删除注册表键
  24.  
  25. Reg.Close()
  26.  
  27. End Sub

猜你在找的VB相关文章