On Aug 14, 11:26 pm, "dancer" <dan...@microsoft.comwrote:
Forgive me for being so dumb, but are you saying, do 1) *OR* 2)?
Yes, it's either 1) OR 2)
In 1) you will have two separated methods (as it is now in your code)
for two buttons/events. Both methods will call two other new methods
SendDatabase() and SendEmail(), where you should place your
correspondent code. You also can combine these two methods in one, say
SendDatabaseAndEmail()
for example
Sub btnSendMail_OnClick(Source As Object, E As EventArgs)
SendDatabaseAndEmail()
End Sub
Sub btnSendDatabase_OnClick(Source As Object, E As EventArgs)
SendDatabaseAndEmail()
End Sub
Sub SendDatabaseAndEmail()
' Code to save data and send an email
.....
End Sub
In 2) I suggested to use point both events to the same method.
As Peter said, it's not always a good idea to put business logic
inside "button_click". As you can see from my examples it's more easy
sometimes to have it in a separated methods and if, for example, you
would need to send an email from other web forms as well, it's really
make sense to move SendEmail() to a class library which can be
accessed from other pages.