ethicalhacker
Well-known member
how do i call the current active mdi form
i have this code but its not working, it says MDIChildform not defined
i have this code but its not working, it says MDIChildform not defined
VB.NET:
Public Class MDIParent1
Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) Handles NewToolStripMenuItem.Click, NewToolStripButton.Click, NewWindowToolStripMenuItem.Click
' Create a new instance of the child form.
Dim MDIChildForm As New Form1()
MDIChildForm.MdiParent = Me
m_ChildFormNumber += 1
MDIChildForm.Text = "Untitled " & m_ChildFormNumber
MDIChildForm.WindowState = FormWindowState.Maximized
MDIChildForm.Show()
End Sub
Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs) Handles OpenToolStripMenuItem.Click, OpenToolStripButton.Click
Dim OpenFileDialog As New OpenFileDialog
OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
OpenFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) And (OpenFileDialog.FileName.Length > 0) Then
Dim FileName As String = OpenFileDialog.FileName
Dim child As MDIChildForm = TryCast(Me.ActiveMdiChild, ChildForm)
child.RichTextBox1.LoadFile(OpenFileDialog.FileName, _
RichTextBoxStreamType.PlainText)
End If
End Sub