Code example : how to disable right click in textbox in

The following code example can be used for disable context menu for textbox in, you can disable right click in textbox in

Public Class Form2
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim txtbox As New TextBoxWithNoContextMenu
        txtbox.Location = New System.Drawing.Point(60, 41)
        txtbox.Name = "TextBox1"
        txtbox.Size = New System.Drawing.Size(100, 20)
    End Sub
End Class
Public Class TextBoxWithNoContextMenu
    Inherits System.Windows.Forms.TextBox
    Protected Overrides Sub WndProc(ByRef messg As System.Windows.Forms.Message)
        Const WM_CONTEXTMENU As Integer = &H7B
        If messg.Msg <> WM_CONTEXTMENU Then
        End If
    End Sub
End Class