-2

I am creating a start-up 2nd level logon screen for businesses and corporate companies to use. However, I am trying to disable using Task Manager by using a Registry DWORD Value. When I add in the code, it comes up with the error "Comma, ')', or a valid expression continuation expected". What can I do?

    Imports Microsoft.Win32

Public Class Form1
    Dim regKey As RegistryKey
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        regKey = Registry.CurrentUser.OpenSubKey("regKey.SetValue("***HKEY***\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System")
        regKey.SetValue("DisableTskMgr", 1, RegistryValueKind.DWord)

    End Sub
    Private Sub frmMyform_FormClosing(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Dim Cancel As Boolean = eventArgs.Cancel
        Dim UnloadMode As System.Windows.Forms.CloseReason = eventArgs.CloseReason
        If UnloadMode = CloseReason.UserClosing Then

            Cancel = True
        End If
    End Sub

End Class

My problem is with the HKEY system above. Thanks in advance!

dbc
  • 104,963
  • 20
  • 228
  • 340

1 Answers1

0

I think this should look like this:

regKey = Registry.CurrentUser.OpenSubKey( "regKey.SetValue(""***HKEY***\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"")" )

See Escape double quote in VB string

MsgBox("""") ' Prints a single "
Community
  • 1
  • 1
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378