Results 1 to 8 of 8

Thread: Trap the paste?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833

    Trap the paste?

    I have a rich text box that has a cetain format to it...

    I am trapping keystrokes to prevent certain things from being entered.

    How can I check what is being pasted from the clipboard before the text is actually inserted into the richtextbox.

    I do not wish to do this with _change... I need to trap it before the data is pasted.

    any help would be great!
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  2. #2
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    I know this is not the best way but why not do something like this.

    VB Code:
    1. Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
    2.     Str = KeyCode & " " & Shift
    3.    
    4.     If KeyCode = vbKeyV And Shift = 2 Then
    5.         RichTextBox1.Text = Str
    6.     End If
    7.     KeyCode = 0
    8. End Sub

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Thanks

    I'll pretend I didn't ask... not sure why I though it would be so complicated..

    I guess with a regular text box you can right click it and then select paste but with a rich text box its not there.

    thanks
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  4. #4
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    I am sorry did you ask something? No just kidding. You are welcome.

  5. #5
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    Just to let you know, in case you're later using the RTB and wonder "where in the world did the menu go?", it isn't on by default. All of the options are still there as in a normal textbox, but it can be turned on/off with RTB.AutoVerbMenu.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  6. #6
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    That is good to know. Hey i also have a 1.2 ghz with half a gig of ram and a 60 gig harddrive. It's a soyo board. Runs pretty nice. Hey and what is looping midis.

  7. #7
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    In this case, it's just playing an midi in VB, and having it replay once it's over automatically, with no timers or anything "sloppy" like that .
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  8. #8
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    gotcha.

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