我的项目有问题,我有 2 个表格,1 个表格MDI container = true
和 1 个表格是子表格。我有如下父形式的代码
Public Class frmInduk
Dim afrmDaftarBarang As frmDaftarBarang = frmDaftarBarang.instance
Private Sub DataBarangToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataBarangToolStripMenuItem.Click
With afrmDaftarBarang
.MdiParent = Me
'Dim afrmDaftarBarang As frmDaftarBarang = frmDaftarBarang.instance
.Show()
.Focus()
End With
End Sub
End Class
而且,在我的孩子形式中,我有如下代码
Public Class frmDaftarBarang
Private Shared anInstance As frmDaftarBarang
Public Shared ReadOnly Property instance() As frmDaftarBarang
Get
If anInstance Is Nothing Then
anInstance = New frmDaftarBarang
End If
Return anInstance
End Get
End Property
End Class
当我运行这个项目时,没问题。我的项目可以运行得很好。但是当我打电话时麻烦来了frmDataBarang
,然后我关闭了,但是当我frmDataBarang
再次打电话时,我得到了一些错误虱子图片波纹管
我希望有人能帮助我:(