Morning all
I'm going mad here. I have created a registry value to run an exe at login...
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "GPIBControl", "C:\Program Files\GPIB Controller\GPIB Control.exe")
That works just fine but does anybody know how I can delete it?
I've tried..
My.Computer.Registry.CurrentUser.DeleteValue("GPIBControl")
and
My.Computer.Registry.CurrentUser.DeleteValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\GPIBControl")
to no avail. It returns a "No value exists with that name" error.
Any help much appreciated.
The actual function is pasted below.
Function ToggleRunAtLogin()
Dim Result As String
Try
Result = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "GPIBControl", Nothing)
If Result = Nothing Then
MsgBox("Run at login enabled")
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "GPIBControl", "C:\Program Files\GPIB Controller\GPIB Control.exe")
Else
MsgBox("Run at login disabled")
My.Computer.Registry.CurrentUser.DeleteValue("GPIBControl")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
I'm going mad here. I have created a registry value to run an exe at login...
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "GPIBControl", "C:\Program Files\GPIB Controller\GPIB Control.exe")
That works just fine but does anybody know how I can delete it?
I've tried..
My.Computer.Registry.CurrentUser.DeleteValue("GPIBControl")
and
My.Computer.Registry.CurrentUser.DeleteValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\GPIBControl")
to no avail. It returns a "No value exists with that name" error.
Any help much appreciated.
The actual function is pasted below.
Function ToggleRunAtLogin()
Dim Result As String
Try
Result = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "GPIBControl", Nothing)
If Result = Nothing Then
MsgBox("Run at login enabled")
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "GPIBControl", "C:\Program Files\GPIB Controller\GPIB Control.exe")
Else
MsgBox("Run at login disabled")
My.Computer.Registry.CurrentUser.DeleteValue("GPIBControl")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function