Results 1 to 6 of 6

Thread: Implementing a good Cut/Copy/Paste feature!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    I'm making an ordinary program, it consists of many controls such as Webbrowser, Text Box, Rich Text Box, etc.. I have a menu that has Cut/Copy/Paste in it. I want those to work just as they would in any other program... How do I do that??
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'paste into a textbox 
    Text1 = Clipboard.Gettext 
    
    'get text from a textbox 
    Clipboard.Settext Text1.text 
    
    'copy a variable content to clipboard 
    Clipboard.Settext MyVar 
    
    'clear the clipboard 
    Clipboard.Clear
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    that will only work if you are using a textbox called text1! I want it to work for all controls!
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  4. #4
    Lively Member
    Join Date
    Feb 2001
    Location
    Malaysia
    Posts
    71
    You could use the ActiveControl property of the form to find out the control that the caret is currently in.

    eg:
    Code:
        Dim ctl as Control
        Set ctl = Me.ActiveControl
    
        If TypeOf ctl Is TextBox Or TypeOf ctl Is RichTextBox Then
            Clipboard.SetText ctl.SelText
        ElseIf TypeOf ctl Is WebBrowser Then
            ' I have not used this control before, so ask for others help
        End If

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    any1 else??
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    It seems to me that AhBeng has the right idea....But Isn't there an easier way of doing his method...BUT, I'll have over 50 lines of code just for the "Copy Feature" because I have lots of controls on my form!!!
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


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