1 Attachment(s)
kill application (process) in Vb6
Hi
Always when close my application and after open again the application in task manager I tried code below, but no worked
Code:
Private Sub Form_Unload(Cancel As Integer)
Dim objCtrl As Control
Dim objForm As Form
For Each objForm In Forms
If objForm.hwnd <> Me.hwnd Then
Unload objForm
Set objForm = Nothing
End If
Next objForm
Unload Me
Exit Sub
End Sub
When open app show me
Attachment 165469
Re: kill application (process) in Vb6
Te without te Unload Me, the form is unloading
Re: kill application (process) in Vb6
Seems very convoluted to me.
Form1.frm:
Code:
Option Explicit
Private Sub Form_Load()
Dim I As Integer
Dim Form As Form
For I = 1 To 3
Set Form = New Form2
Form.Caption = "Child #" & CStr(I)
Form.Show
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim Form As Form
For Each Form In Forms
If Not Form Is Me Then Unload Form
Next
End Sub
Form2.frm:
Code:
Option Explicit
Private Sub Form_Unload(Cancel As Integer)
MsgBox Caption & " unloading."
End Sub
Works fine, lasts a long time.