I have search almost the entire internet looking for the answer to this problem but no luck. I am working on a project that requires me make a MDI, which I did. The problem that I am having is that none of the menus like the cut and paste work in the MDI Child, Please help because I don't know what I am doing wrong. I have tried different types of code and still can't get it to work. All I am trying to do is copy or paste text using MDI parent menu controls, rather then creating menu controls for all the MDI children

Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CutToolStripMenuItem.Click
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard

        If (Me.ActiveMdiChild Is Nothing) Then
            Exit Sub
        End If
        Dim strType As String = Me.ActiveMdiChild.ActiveControl.GetType().ToString  
        If (strType = "Sytstem.Windows.Forms.TextBox") Then
            CType(Me.ActiveMdiChild.ActiveControl, Windows.Forms.TextBox).Cut()
        End If
    End Sub
7 Years
Discussion Span
Last Post by Romana101

Thank you, look it up and it work, But now I a have another issue when I added my toolstrip in now, it seems that it doesn't won't to work I have another form that I load without the toolstrips and everything works as supposed to....????

Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PasteToolStripMenuItem.Click
'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to retrieve information from the clipboard.
' Determine the active child form.
Dim activeChild As Form = Me.ActiveMdiChild

' If there is an active child form, find the active control, which
' in this example should be a RichTextBox.
If (Not activeChild Is Nothing) Then
Dim theBox As TextBox = CType(activeChild.ActiveControl, TextBox)
If (Not theBox Is Nothing) Then
' Create a new instance of the DataObject interface.
Dim data As IDataObject = Clipboard.GetDataObject()
' If the data is text, then set the text of the 
' RichTextBox to the text in the clipboard.
If (data.GetDataPresent(DataFormats.Text)) Then
theBox.SelectedText = data.GetData(DataFormats.Text).ToString()
End If
End If
MessageBox.Show("You need to select a RichTextBox.")
End Try
End If
End Sub

Hello can anyone help me with printing a from a textbox on a child form with the print control being on the parent

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.