Interesting copy/paste dilema

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Infog
    New Member
    • Dec 2008
    • 36

    Interesting copy/paste dilema

    In testing cut/copy/paste for my program, I realized that all forms that are a child of my MDIparent1 form lose their cut/copy/paste abilities.

    Is there a common reason for this? Is this something that I need to implement?

    I show the child forms by using something along these lines:
    Code:
    Form1.mdiparent = MDIparent1
    Form1.show
    I've found that the same Form1 does have cut/copy/paste in text boxes while not a MDIchild, by using the normal Ctrl+C, Ctrl+V.
  • !NoItAll
    Contributor
    • May 2006
    • 297

    #2
    This is indeed curious - and I have no real help other than to suggest that you read the keystrokes yourself and put the text into the clipboard on your own. It only takes a couple lines of code in the keydown event for each textbox.

    Code:
        
        Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
            If e.Control = True Then
                If e.KeyCode = Keys.C Then
                    Clipboard.SetText(TextBox1.SelectedText)
                ElseIf e.KeyCode = Keys.X Then
                    Clipboard.SetText(TextBox1.SelectedText)
                    TextBox1.SelectedText = String.Empty
                ElseIf e.KeyCode = Keys.V Then
                    TextBox1.SelectedText = Clipboard.GetText
                ElseIf e.KeyCode = Keys.Z Then
                    TextBox1.Undo()
                End If
            End If
    
        End Sub
    I haven't test all of the above, but I think this covers all of the "basic" functions you want.

    Des

    Comment

    Working...