title: Is a return statement necessary for try catch
body: <p>I put a try/catch block around some email sending logic. If the email succeeds, it gives a confirmation message, if it fails, it gives a failure message. Visual Studio is warning me that the function doesn't return a value on all code paths. Do I need to put return statements in each the Try and Catch blocks? If I do, for example put Return statements of False or Null at the end of the Try and Catch, will the other code preceding the Return statements still execute?</p>
  
  <pre><code>Function Sendmail(ByVal subject As String, ByVal msg As String, ByVal fromAddress As String, ByVal toAddress As String)            
  Try
                  Dim message As New MailMessage
                  message.From = New MailAddress(fromAddress)
                  For Each s As String In toAddress.Split(New [Char]() {";"c})
                      message.To.Add(New MailAddress(s))
                  Next
                  message.Subject = subject
                  message.Body = msg
                  message.IsBodyHtml = False
                  Dim client As New SmtpClient
                  client.Send(message)
                  pnlEmailSuccess.Visible = True
              Catch ex As Exception
                  pnlEmailSuccess.Visible = False
                  pnlEmailError.Visible = True
                  lblErrorMsg.Text = ex.ToString
              End Try
  End Function
  </code></pre>