I am making a fake virus program as a joke and would like to know how to disable all of the keys except for the shift and enter keys.(these will exit the program) Thanks

See if this helps.

Public Class Form1
    Private WithEvents myCoolTimer1 As New Timer With {.Interval = 100, .Enabled = True}

    Private Sub Form1_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        If e.KeyCode = Keys.Escape Then Me.Close() '// .Close app. on ESC key.
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        With Me
            .KeyPreview = True '// for ESC key.
            .Opacity = 0 '// make transparent.
            .ShowInTaskbar = False
        End With
    End Sub

    Private Sub myCoolTimer1_Tick(sender As Object, e As System.EventArgs) Handles myCoolTimer1.Tick
        With Me
            If Not .Focused Then .Activate() '// keep app. constantly focused.
        End With
    End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.