Results 1 to 3 of 3

Thread: Problem with cut/copy/paste [resolved]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    the UK
    Posts
    265

    Problem with cut/copy/paste [resolved]

    Hello,

    I'm using this code to work cut, copy and paste from the menu bar:



    Code:
    Private Sub mnuCopy_Click()
        If TypeOf Screen.ActiveControl Is TextBox Then
            Clipboard.SetText Screen.ActiveControl.SelText
        End If
    End Sub
    Code:
    Private Sub mnuCut_Click()
        
        If TypeOf Screen.ActiveControl Is TextBox Then
            Clipboard.SetText Screen.ActiveControl.SelText
            Screen.ActiveControl.SelText = Chr(0)
        End If
        
    End Sub
    Code:
    Private Sub mnuPaste_Click()
        
        If TypeOf Screen.ActiveControl Is TextBox Then
            Screen.ActiveControl.SelText = Clipboard.GetText
        End If
      
    End Sub
    but if I right-click in a text box - it seems to work independantly from the routine I have above. It's as if there were two clipboards?!

    Any ideas why this might be happening?

    Simon
    Last edited by simonp; Apr 22nd, 2004 at 11:46 AM.

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Before you set the clipboard, you should invoke Clipboard.Clear.

    Textboxes automatically have the copy/cut/etc support menu.

    You can use the richtextbox control and set the autoverbmenu property to false, then it'll not have that menu.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    the UK
    Posts
    265
    Originally posted by DiGiTaIErRoR
    Before you set the clipboard, you should invoke Clipboard.Clear.
    That did the job DiGiTaIErRoR

    Many thanks

    Simon

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