OKIEWARDOYO

VB.NET No.15-6

Oct 4th, 2013
1,531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.97 KB | None | 0 0
  1. Public Class Form1
  2.  
  3.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  4.  
  5.         If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "StartUpApp", Nothing) Is Nothing Then
  6.             MessageBox.Show("registry belum ada bro")
  7.             checkBoxStartUp.Checked = True
  8.         Else
  9.             checkBoxStartUp.Checked = False
  10.         End If
  11.  
  12.     End Sub
  13.  
  14.     Private Sub buttonSaveClose_Click(sender As Object, e As EventArgs) Handles buttonSaveClose.Click
  15.  
  16.         If (checkBoxStartUp.Checked = True) Then
  17.             My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "StartUpApp", "[path dari aplikasi]")
  18.         Else
  19.             Dim subKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
  20.             subKey.DeleteValue("StartUpApp")
  21.  
  22.         End If
  23.         Close()
  24.  
  25.     End Sub
  26.  
  27. End Class
Advertisement
Add Comment
Please, Sign In to add comment