Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    Intercepting CTRL-v before RichTextBox Paste (VB)

    I have learned that the RichTextControl supports CTRL-v, Shift-Insert, Drag/Drop, and other when pasting data. My goal is to pre-process the pasted data and not have it go directly into the RichTextBox document. I have tried to use the Form_KeyDown event with no results- i suspect that CTRL-v is a windows thing. I might have to use a combination of APIs functions to do what i want. Has anybody solved this problem? Any suggestions on how i should tackle this?

    Thank you,


  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Springfield, Ohio, USA
    Thanked 2 Times in 2 Posts

    Re: Intercepting CTRL-v before RichTextBox Paste (VB)

    Both the KeyDown and the Key Press fire, but the paste occures between them. So to change the behavior of Ctrl+V, use the KeyDown. Here is an example which disables Ctrl+V: HTH --Sam
    <pre>Option Explicit
    Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyV And Shift = vbCtrlMask Then
    Debug.Print "Down"
    KeyCode = 0
    End If
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

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