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:
  1. Private Sub JMSTreeView_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles JMSTreeView.AfterSelect
  2.  
  3.         Me.lblTreeTitle.Text = "MAIN MENU | " & JMSTreeView.SelectedNode.FullPath
  4.  
  5.         '==========================================================================================
  6.         Dim FileToOpen As String
  7.         For intLoopIndex As Integer = 0 To (TreeData.Tables("Qry_Admin_TreeMenu_VBNET").Rows.Count) - 1
  8.             If TreeData.Tables("Qry_Admin_TreeMenu_VBNET").Rows(intLoopIndex).Item(0) = e.Node.Tag Then
  9.                 FileToOpen = (TreeData.Tables("Qry_Admin_TreeMenu_VBNET").Rows(intLoopIndex).Item(6).ToString)
  10.             End If
  11.         Next intLoopIndex
  12.  
  13.         '=====================================================================================


Now my mind is saying to me that this should work. To open the form, I used the following code:

VB Code:
  1. Dim MdiFrm As FrmMAIN
  2.         Me.GlobalForm = Me
  3.         Dim FrmNewChild As New FileToOpen
  4.         FrmNewChild.MdiParent = MdiFrm
  5.         'Me.Hide()
  6.         FrmNewChild.Show()
  7.  
  8.     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