Question exit application after messagebox.ok click

ud2008

Well-known member
Joined
Jul 5, 2010
Messages
148
Programming Experience
Beginner
I've run into a problem.

I have a form which checks on load if an host (ip) is available.
If not it shows a messagebox and exits the application.

Here is when the problem occurs.

Now the messagebox shows just a short time, then the app exits automatically.
But what I would like is, after a user hits the OK button the app exits.

Here is the code I use:
VB.NET:
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If My.Computer.Network.Ping("195.128.174.38") Then
                'continue
            End If
        Catch
            Dim messge2 As DialogResult
            messge2 = MessageBox.Show( _
               "The host is not available." & vbNewLine & _
               "Make sure you have an internet connection and try again later!", My.Application.Info.Title, _
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Application.Exit()
        End Try
    End Sub

Thanks
 
Back
Top