Timer issue [vb.net]

孤街浪徒 提交于 2019-12-13 04:44:17

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!