Try / Catch

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I am sending an e-mail and I need to call a function the following way:

1. Display("OK") if Email was SENT
2. Display("Error") if Email was NOT SENT

I have this code block:

Try
SmtpMail.Send(email)
Catch ex As Exception
Display("Error")
End Try

My problem is where to place Display("OK") which will only be called if
no exception is Catched, i.e., if the email was sent.

How can I do this?

Thanks,
Miguel
 
Hi ,

Try
SmtpMail.Send(email)
Display("OK")
Catch ex As Exception
Display("Error")
End Try

Best regards....
 
Try
SmtpMail.Send(email)
Display("Ok")
Catch ex As Exception
Display("Error")
End Try

Karl
 
[snip]
Try
SmtpMail.Send(email)
Catch ex As Exception
Display("Error")
End Try

My problem is where to place Display("OK") which will only be called if no
exception is Catched, i.e., if the email was sent.
[snip]

Try
SmtpMail.Send(email)
Display("OK") // RIGHT HERE ****
Catch ex As Exception
Display("Error")
End Try
 
Back
Top