2017-07-15 81 views
1

我創建了一個註冊表單,並添加了一個帶有「更新,刪除,刷新」功能的表單以及一個DataGridView以顯示註冊表單中的數據。如何在另一個表單中加載表單?

這裏是我的形式:

Featured Form

因爲我插一個TreeView,當我點擊更新按鈕,在畫面中,我得到的錯誤:

Object Reference Not set to an instance of an object

我覺得我的代碼在TreeView窗體中是錯誤的。

這是我進入:

Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect 

    If e.Node.Text = "Update/Delete Student" Then 

     Dim regstu As New Registered_Students 

     regstu.MdiParent = Me 

     regstu.Show() 

    End If 

End Sub 
+0

有助於發佈堆棧跟蹤。 –

回答

0

私人小組TreeView1_AfterSelect(BYVAL發件人爲System.Object的,BYVALË作爲System.Windows.Forms.TreeViewEventArgs)處理TreeView1.AfterSelect

If e.Node.Text = "Update/Delete Student" Then 

    Dim regstu As New Registered_Students 
    Form_father.IsMdiContainer = True 
    Form_father.TopLevel = False 
    regstu.MdiParent = New Form_father 
    Form_father.Panel1_Container.Controls.Add(regstu) 
    regstu.Show() 

End If 

End Sub

相關問題