Solved

Application.exit or Process killing

Posted on 2004-08-16
2
326 Views
Last Modified: 2006-11-17
Hi there,

I need to close my application if the db connect fails....  as there is no winforms instance at this point i am led to believe that application.exit will not work. So i believe i need to process.kill        

But im not sure of the syntax.

    Private Sub connectDB()
        Try
            conSQL = New SqlConnection()
            conSQL.ConnectionString = "Password=oioi;Persist Security Info=True;User ID=meme;Initial Catalog=dbInstance;Data Source=server"
            AddHandler conSQL.InfoMessage, New SqlInfoMessageEventHandler(AddressOf conSQL_infomessage)
            conSQL.Open()
        Catch
            MsgBox("Failed to connect to database server", , "Application will exit")
            Application.Exit()
        End Try
    End Sub

    Public Sub Main()
        Try
            connectDB()
            PrepComm()
        Catch ex As Exception
            MsgBox(ex.toString)
            Exit Sub
        End Try

        Application.Run()
    End Sub

Sorry about the low points... my last 85! :o/
0
Comment
Question by:djdidge
2 Comments
 
LVL 19

Accepted Solution

by:
Desp earned 85 total points
ID: 11808624
you can use
Environment.Exit(Environment.ExitCode)
0
 
LVL 2

Author Comment

by:djdidge
ID: 11808652
thx
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question