Jacksparrow87
Technical User
Hi people,
I was hoping someone could help me out please, I never really used Try and Catch methods but I've just started to get used to them and they are really helpful.
I was hoping someone could offer me some help please, my application is simple as when the 'Save' button gets clicked the information gets saved in to the database and after that Outlook opens ready to send an email (with the same information that gets saved into the database.)
So far I have the following:
Now the problem with the above coding is that if there is an Error updating to the database then the second try method should not trigger off (so outlook should not open) How would I do this? Can I put the 2nd try method in with the first one so if the first one is successfull then the second one can run?
Please help me, thanks.
I was hoping someone could help me out please, I never really used Try and Catch methods but I've just started to get used to them and they are really helpful.
I was hoping someone could offer me some help please, my application is simple as when the 'Save' button gets clicked the information gets saved in to the database and after that Outlook opens ready to send an email (with the same information that gets saved into the database.)
So far I have the following:
Code:
Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
Try
'Coding to save data into the database
MessageBox.Show("Booking Successful!", "CNS Support", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch e1 As Exception
MessageBox.Show("Sorry, Error Updating!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Try
'Coding to open up outlook
Catch e1 As Exception
MessageBox.Show("Sorry, Email cannot be sent at this time!", "Sending Email Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Now the problem with the above coding is that if there is an Error updating to the database then the second try method should not trigger off (so outlook should not open) How would I do this? Can I put the 2nd try method in with the first one so if the first one is successfull then the second one can run?
Please help me, thanks.