Hello, I need some help.
How (what is the best way) to close all open child forms in VB.NET?
Here is my code and screenshot of the program.
vb.net Code:
Public Sub ShowForm(ByVal Frm As Form) For Each frmClose As Form In MainForm.MdiChildren frmClose.Close() frmClose.Dispose() Next With Frm .MdiParent = MainForm .Show() .WindowState = FormWindowState.Maximized End With End Sub
vb.net Code:
Private Sub TsbTPR_Click(sender As Object, e As EventArgs) Handles TsbTPR.Click ShowForm(FrmPermintaan) End Sub
When I click another form, it seems like the "form closing" process is not really neat and see some blink.
Video: https://www.screencast.com/t/M8NYwOVDH
Also, when I use the above code and I click the same form, it gives this error:
Cannot access a disposed object.
Please help




Reply With Quote
