Friday, April 30, 2010

Run Program on Windows Startup Tutorial Visual Basic {VB.net}

Hi all, today i will be teaching u all how to add and read value from registry in vb.net (visual basic 2008)

Codes:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim regKey As Microsoft.Win32.RegistryKey
Dim KeyName As String = "Test"
Dim KeyValue As String = "C:\test\test.exe"
regKey=Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Window\CurrentVersion\Run", True)
If regKey.GetValue(KeyName) = Nothing Then
MsgBox("No value found")
regKey.SetValue(KeyName, KeyValue, Microsoft.Win32.RegistryValueKind.String)
MsgBox("keyValue " & KeyName & " has been created")
Else
MsgBox("This Program already exists", vbInformation, "Information")
End If
End Sub

End Class

_________________________________________________________________________

Here is the video tutorial:

No comments:

Post a Comment