Almost everytime i run my program then exit
I'd look in the Task Manager, and see my program's name there
How would I close the program and all of the forms
or even end the process?
Printable View
Almost everytime i run my program then exit
I'd look in the Task Manager, and see my program's name there
How would I close the program and all of the forms
or even end the process?
easy as thisorVB Code:
formname.closeVB Code:
Unload formanme
you can simply use the End command
VB Code:
End
VB Code:
Dim frm As Form For Each frm In Forms Unload frm Next
Best not use the End command since that won't free memory and stuff that your program was using.
Also what do you mean by 'Almost every time' what do you normally do so it doesn't close?
I know how to close forms :P
i've tried all of the examples above
but when I close all of the forms, the process of the program is still running
and the only way to exit is to go to the task manager
do you have an invisible form running?
try this codeactually this code is to close an application... i hope it helps you... correct me if i'm wrong postVB Code:
'Declaration Option Explicit Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Const WM_CLOSE = &H10 'Code Public Sub CloseProgram(ByVal Caption as String) Handle= FindWindow(vbNullString, Caption) If Handle = 0 Then Exit Sub SendMessage Handle, WM_CLOSE, 0&, 0& End Sub
yes, works like a lovely charm;)
thank you
how did you do it?
you're CloseProgram() function
Dear friends
I have gone through that condition. It is like miracle u see It happens soetimes only.....
The Posibilities I found out was that there might be some of ur components or activex needs to be close I dont Know regarding your code. So I dont Know what type of the components ur using.
One best Example is Connection whenever your application gets close u must close ur Connection so look to the components or activex types of stuffs u have used in your project