G
Guest
Hi all,
How to close a sub-form opened by showDialog()?
On the main form, I open a new form by using showDialog().
There is a Timer control on the main form, when Timer.Tick raises, the
program closes the sub-form and main form.
But now, the sub-form cannot be closed and the Me.close() rases error.
Private subForm as Form
Private Sub btnM_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnM.Click
Dim frm As New Form2(Me)
subForm = frm
frm.ShowDialog()
End Sub
Private Sub Logout(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If Not subForm Is Nothing Then
subForm.Close()
End If
Me.Close()
End Sub
Thanks in advance.
Regards,
Alan
How to close a sub-form opened by showDialog()?
On the main form, I open a new form by using showDialog().
There is a Timer control on the main form, when Timer.Tick raises, the
program closes the sub-form and main form.
But now, the sub-form cannot be closed and the Me.close() rases error.
Private subForm as Form
Private Sub btnM_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnM.Click
Dim frm As New Form2(Me)
subForm = frm
frm.ShowDialog()
End Sub
Private Sub Logout(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If Not subForm Is Nothing Then
subForm.Close()
End If
Me.Close()
End Sub
Thanks in advance.
Regards,
Alan