Try / Catch

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
 
U

ugurceng

Hi ,

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

Best regards....
 
K

Karl Seguin

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

Karl
 
J

John MacIntyre

[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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top