Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable right click menu on textbox 1

Status
Not open for further replies.

russgreen

Programmer
Joined
Dec 7, 2002
Messages
86
Location
GB
Can someone please enlighten me as to how to disable the default rightclick menu that pops up on textboxes?

Russ Regards,
Russ

 
Well there must be a better way to do it than this, but here goes.
Drop a new context menu onto the form, and leave it as having no items.
Then set the text box's context menu property to be the empty one you just created.
At run time, nothing happens when you right click.

Anyone any better ideas?

Mark [openup]
 
Inherit the text box and remove the menu....

Public Class MyTextBox
Inherits TextBox

Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
If m.Msg = &H204 Then ' WM_RBUTTONDOWN
Return 'ignore it
End If
MyBase.WndProc(m)
End Sub 'WndProc
End Class 'MyTextBox Regards,
Russ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top