Exit application?

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Exit application?
Dummy1912
Hello,

Seems sometimes we can start and exit our app without problems
but then sometimes we get a error and the app just crash without exit it

why???
search on net but not really a solution found :(

anyone?

'used
Code: Select all
    Private Sub FrmLogin_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        e.Cancel = True
        Try
            If MyFunctions.IsExit = True Then
                Util.displayMessage("Do you really want to exit from '" & MyFunctions.ProjectName & "'?", MyFunctions.ProjectName, "YesNo")
                If MessageValue = 3 Then
                    MyFunctions.IsExit = False
                    e.Cancel = True
                ElseIf MessageValue = 2 Then
                    e.Cancel = False
                    Environment.Exit(0)
                End If
            Else
                e.Cancel = False
            End If

        Catch ex As Exception
            e.Cancel = False
           Environment.Exit(0)
        End Try
    End Sub

'tried again
Code: Select all
    Private Sub FrmLogin_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        e.Cancel = True
        Try
            If MyFunctions.IsExit = True Then
                Util.displayMessage("Do you really want to exit from '" & MyFunctions.ProjectName & "'?", MyFunctions.ProjectName, "YesNo")
                If MessageValue = 3 Then
                    MyFunctions.IsExit = False
                    e.Cancel = True
                ElseIf MessageValue = 2 Then
                    e.Cancel = False
                    End 
                End If
            Else
                e.Cancel = False
            End If

        Catch ex As Exception
            e.Cancel = False
            End
        End Try
    End Sub

keeps failing

https://drive.google.com/open?id=0B37cl ... XRSNTlxMzQ
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: Exit application?
CodenStuff
Could try using Exit Sub instead of End

Also try outputting the whatever the error is in your catch statement to see what is happening.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Exit application?
Dummy1912
Hi,

If we use exit sub , this won't really terminate the application... right ?
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: Exit application?
CodenStuff
Possibly something else running in the background that isn't being stopped/exited correctly which is why it is a good idea to try catch/output the error to see what is going on :duh;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Exit application?
Dummy1912
Hi,

Okay i will look into it ;)

Thanks
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
5 posts Page 1 of 1
Return to “Coding Help & Support”