Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Visual Basic: Clipboard Methods

    I have 4 buttons that I need to add code to. They are Cut, Copy, Paste and Delete. I need these buttons to function as expected, but my book never explains anything beyond "Use the Clipboard methods". I'm starting to hate this class. Thanks in Advance.

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    Georgia
    Posts
    306
    Thanks
    0
    Thanked 0 Times in 0 Posts
    for the cut code:


    On Error Resume Next
    Clipboard.SetText ActiveForm.rtfText.SelRTF
    ActiveForm.rtfText.SelText = vbNullString



    for the copy code:


    On Error Resume Next
    Clipboard.SetText ActiveForm.rtfText.SelRTF



    for the paste code:


    On Error Resume Next
    ActiveForm.rtfText.SelRTF = Clipboard.GetText




    and for delete? i dont know what you mean delete.....but cut and delete should be the same


    these are on the asumption that these controls will be for a textbox...just change the names to the name for your textbox if thats what its for.
    Last edited by DsgnrsTLZAdmin; 01-15-2004 at 01:07 AM.
    ~Designer's Toolz~

  • #3
    New Coder
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    That is pretty much what I need.

    You're right. The Delete button and the Cut button would both remove the selected text from the text box, but Delete would do it without saving it to the Clipboard. Yes, my teacher does look at the code to see if I'm cheating. Thank you TLZ

  • #4
    New Coder
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I figured it out...

    I took the code that you gave me and put the following line of code into my program:

    Code:
    ActiveForm.rtfText.SelRTF = ""
    So when you click the delete button, it takes the selected text and replaces it with what's between the quotes (absolutely nothing, lol). It's not pretty, I guess, but it certainly gets the job done.

    Thank you again.

  • #5
    Regular Coder
    Join Date
    Jan 2004
    Location
    Georgia
    Posts
    306
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No problem, have fun with your adventures in VB. And what you did for the delete is perfect fine, in my opionin anything that gets the job done is fine even if some people say its sloppy.
    Last edited by DsgnrsTLZAdmin; 01-15-2004 at 10:22 PM.
    ~Designer's Toolz~


  •  

    Posting Permissions

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