Reputation: 2330
I have a windows application that when I close it still runs on the background process of task manager. I tried going through Application/Shutdown Mode/When start up form closes, but my startup form is a login form which then takes me to my main application which has a close button. I also tried the option When last form closes
, no effect.
On this close button I have tried Me.Close().
and also I have tried Application.Quit()
my both still not closing my application completely.
How can I terminate the application completely and clear it from the background services?
Upvotes: 0
Views: 14494
Reputation: 587
In Login form
create a instance of MainForm
show the MainForm
and close the Login
form
If you want to pass any value to MainForm
from Login
form, create a public variable in MainForm
. Eg. Public userAuth As String
Example:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim mf As New MainForm()
mf.userAuth = "Admin"
mf.Show()
Me.Close()
End Sub
Upvotes: 0
Reputation: 39122
"my startup form is a login form which then takes me to my main application"
You are probably hiding the login form with Hide(), which is keeping the app alive. With the When last form closes
option set, you can instead call Close() against the login form after showing the main form. Then it should shut down properly.
Upvotes: 1