Results 1 to 11 of 11

Thread: Easy question.. please help!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Posts
    217

    Easy question.. please help!

    I have a rich text box in my project and i want it to always use my standardized font, size, color ect...... but right now if you perform and Ctrl+C inside another rtf app like wordpad then ctrl+v into my app it shows up as it did inside wordpad. How do i prevent this from happening?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    If you are only going to have one font, size and color, why not just use a standard textbox? That will eliminate problems like that.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Posts
    217
    Well for one I can't have a character limit, and the program has syntax highlighting which does use multi color. I just don't want someone to be able to past in out of place text. I would prefer it best if I could prevent the Control-V keystrokes from being used inside the rtf box.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Posts
    217
    *bump*

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Posts
    217
    *bump*

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    You have no control over the format of what is currently residing on the Clipboard (as a result of a copy - CTRL C)

    Are you saving the contents of your richtextfile to a field in a backend Db?

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Posts
    217
    Yes, and also into non-rtf printed text files. My question is not how to prevent ctrl + c from grabbing formmatting but how to prevent control + v from being used inside the rtf box. That way my menu Paste (short cut control + v ) will come into play and i can properly modify the text in the clipboard. How do i keep the rich text box from recieving control + v?

  8. #8
    yaz
    Guest

    why don't you set the locked property to true?

    why don't you set the locked property to true?

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Posts
    217
    Because I do want the user to be able to modify the contents of the text box, but not be able to use ctrl + v.

  10. #10
    Tygur
    Guest
    Try this:
    VB Code:
    1. Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
    2. If (KeyCode = vbKeyInsert And Shift = vbShiftMask) Or _
    3.   (KeyCode = vbKeyV And Shift = vbCtrlMask) Then
    4.     RichTextBox1.SelText = Clipboard.GetText(vbCFText)
    5.     KeyCode = 0
    6. End If
    7. End Sub

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Posts
    217
    Thank you!

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