Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Disable TextBox Right Click popup menu - Very Eas
Author:
Siddharth Srivastava
E-mail:
Click to e-mail author
Submitted:
8/7/2006
Version:
VB6
Compatibility:
VB6
Category:
Controls
Views:
39140
Disable TextBox control's right click context menu to appear without using any API.... There are several other hard ways to do this (like SendMessage, Hooking etc.) But here is the most simple three line code you can use in your application - No API ! Only thing to remember while using this code is - there should at least be one more control on your VB form other than your text box control and textbox's tabindex should not be 0 !
Declarations:
Dim bIsRightClk As Boolean
Code:
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then bIsRightClk = True End If End Sub Private Sub Form_Load() bIsRightClk = False End Sub Private Sub Text1_GotFocus() If bIsRightClk = True Then Text1.Enabled = False Me.SetFocus Text1.Enabled = True End If End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement