我创建了一个注册表单并添加了一个包含功能的表单"更新,删除,刷新,"以及DataGridView
以显示注册表单中的数据。
这是我的表格:
由于我插入TreeView
,当我点击图片中的“更新”按钮时,出现错误:
对象引用未设置为对象的实例
我认为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)
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object,ByVal e As 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