Visual Basic Express 2008 Custom Error Message

  • Thread starter Thread starter Cass
  • Start date Start date
C

Cass

I've programmed an autorun program. I would like to create a custom
error message when a person clicks on a button & the file is not in
the directory.

For example, the code for a button looks like this:
Private Sub filename_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles filename.Click
Shell("\file.exe", vbMaximizedFocus)
End Sub

If I remove file.exe from the directory because they hadn't, for
example, purchased the software, I want a custom error message to
appear.

Can anyone help me with the code for this?
 
I've programmed an autorun program. I would like to create a custom
error message when a person clicks on a button & the file is not in
the directory.

For example, the code for a button looks like this:
Private Sub filename_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles filename.Click
Shell("\file.exe", vbMaximizedFocus)
End Sub

If I remove file.exe from the directory because they hadn't, for
example, purchased the software, I want a custom error message to
appear.

Can anyone help me with the code for this?

If Not System.IO.File.Exists ("\file.exe") Then
' error message
Else
' shell
End If
 
If Not System.IO.File.Exists ("\file.exe") Then
        ' error message
Else
        ' shell
End If

So then would it end up like this?

Private Sub filename_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles filename.Click
Shell("\file.exe", vbMaximizedFocus)

If Not System.IO.File.Exists ("\file.exe") Then
' This File does not exist
Else
' shell
End If
End Sub
 
So then would it end up like this?

Private Sub filename_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles filename.Click
        Shell("\file.exe", vbMaximizedFocus)

If Not System.IO.File.Exists ("\file.exe") Then
        ' This File does not exist
Else
        ' shell
End If
    End Sub

NEVERMIND, I was being lazy. I've got it now. Thanks so much!!!
 
Back
Top