Try it:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
For Each selProcess As Process In Process.GetProcesses
If selProcess.ProcessName = "taskmgr" Then
selProcess.Kill()
Exit For
End If
Next
End Sub
End Class
or for example you can set the registry key to this value:
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr, i.e.
systemRegistry.SetValue("DisableTaskMgr", 1)
or for example you can write :
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim systemRegistry As RegistryKey = _
Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
systemRegistry.SetValue("DisableTaskMgr", 1)
systemRegistry.Close()
End Sub
End Class