问题
my situation is explained here: Closing multiple new form [VB.NET]
i have three forms: the main form(A), a secondary form (B) and third form (C). The form A must be always visibile and usable, the form B opening from form A and the form C opening form the form B. I open multiple instance of form C (i do not know how much instance are) and i'm using this code in a command button on form B:
Dim newform As New modifica_normale
newform.LoadOrders(commessa_da_modificare, id_da_modificare, False)
newform.Show()
now the problem is: when i close the form B all of forms C are closing correctly, but the timer on form C do not stop when the form B and the form C are closed. I've already tried to put, on form C closing:
Private Sub modifica_normale_Closed(sender As Object, e As EventArgs) Handles Me.Closed
Timer1.Enabled = False
Timer1.Stop()
Timer1.Dispose()
Me.Dispose()
End Sub
the code that i'm using to close all of forms C is (the code is in the formB.closed event):
before:
For Each frmCheck As Form In Application.OpenForms
If frmCheck.Name = modifica_normale Then
frmCheck.Close()
GoTo before
End If
Next
来源:https://stackoverflow.com/questions/32633067/timer-issue-vb-net