Hi all,
I've got a range of child forms which I want to open with a treeview.
Now I get the name of the form I need to open from the following code:
VB Code:
Private Sub JMSTreeView_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles JMSTreeView.AfterSelect Me.lblTreeTitle.Text = "MAIN MENU | " & JMSTreeView.SelectedNode.FullPath '========================================================================================== Dim FileToOpen As String For intLoopIndex As Integer = 0 To (TreeData.Tables("Qry_Admin_TreeMenu_VBNET").Rows.Count) - 1 If TreeData.Tables("Qry_Admin_TreeMenu_VBNET").Rows(intLoopIndex).Item(0) = e.Node.Tag Then FileToOpen = (TreeData.Tables("Qry_Admin_TreeMenu_VBNET").Rows(intLoopIndex).Item(6).ToString) End If Next intLoopIndex '=====================================================================================
Now my mind is saying to me that this should work. To open the form, I used the following code:
VB Code:
Dim MdiFrm As FrmMAIN Me.GlobalForm = Me Dim FrmNewChild As New FileToOpen FrmNewChild.MdiParent = MdiFrm 'Me.Hide() FrmNewChild.Show() End Sub
Now I am getting at line: Dim FrmNewChild As New FileToOpen
The error: Type 'FileToOpen' is not defined
How do I get the right form to be opened, or how do I get the code to accept "FileToOpen" as the form to be opened?
Thanks
Rudi




Reply With Quote