Iam a beginner to vb.i have a project work,related to Quotation software.i want to know how to unload all forms that are loaded on to a panel when clicking a Button.
here i did some codes, in that, one error is displaying like "Collection was modified; enumeration operation may not execute."
the code is given below:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As Form
For Each frm In My.Application.OpenForms
If (frm.Name <> "additems") Then
frm.Dispose()
End If
Next
End Sub
here i did some codes, in that, one error is displaying like "Collection was modified; enumeration operation may not execute."
the code is given below:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As Form
For Each frm In My.Application.OpenForms
If (frm.Name <> "additems") Then
frm.Dispose()
End If
Next
End Sub