Disable TextBox ContextManu

Sani Love 160 Reputation points
2024-01-12T19:00:45.04+00:00

Hello experts I tried both:TextBox.ContextMenu = New ContextMenu TextBox.ContextMenuStrip = New ContextMenuStrip And there's still an issue: right click and drag the mouse out of the TextBox and now release the mouse button, the context manu is shown at that point! Any solution to completely disable it? Thanks.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,337 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,805 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 88,056 Reputation points
    2024-01-12T20:10:50.78+00:00

    If I override WndProc in a TextBox class and handle WM_CONTEXTMENU, with just return; to do nothing, I don't get the default context menu (tested on Windows 10 22H2)


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.