Results 1 to 7 of 7

Thread: VB6 - RichTextBox: Disabling Cut, Copy & Paste

Threaded View

  1. #1

    Thread Starter
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    VB6 - RichTextBox: Disabling Cut, Copy & Paste

    Hai friends,
    Here is a solution to the common problem of disabling cut, copy and paste in a RichTextBox Control.
    I had found it after certain experiments...
    I hope, you all will like it..
    Below is the code:
    Code:
    'Created by Akhilesh B Chandran
    
    Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 45 And Shift = 1 Then KeyCode = 0 'paste(shift + insert)
    If KeyCode = 45 And Shift = 2 Then KeyCode = 0 'copy(ctrl + insert)
    If KeyCode = 86 And Shift = 2 Then KeyCode = 0 'paste(ctrl + v)
    If KeyCode = 67 And Shift = 2 Then KeyCode = 0 'copy(ctrl + c)
    If KeyCode = 88 And Shift = 2 Then KeyCode = 0 'cut(ctrl + x)
    End Sub
    Note: You have to set the AutoVerbMenu property of the Richtextbox control to False(for disabling the popup menu on right click)

    Please post your comments and suggestions...

    -Regards
    Akhilesh B Chandran
    Attached Files Attached Files

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width