title: Passing radio button parameter to another function in vb.net
body: <p>I have 2 functions, one is SaveData() and the other is SendEmail()</p>
  
  <p>in the SaveData() the radio buttons that are selected are saved, and the SendMail() is called at the end.</p>
  
  <p>in the SendMail() the radio buttons are "tested" and then one of two emails is sent out based on the radio choices.</p>
  
  <p>The problem I am having is passing the parameters correctly.  I have tried several different method but the parameters are not being sent to SendMail()</p>
  
  <p>The radio buttons are Yes/No questions</p>
  
  <p>Any thoughts on why the parameters are not being passed?</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>Protected Function SaveData()
  ...
  Q1 = Me.rblnewqst1.SelectedValue
          Q2 = Me.rblnewqst2.SelectedValue
          Q3 = Me.rblnewqst3.SelectedValue
          Q4 = Me.rblnewqst4.SelectedValue
          Q5 = Me.rblnewqst5.SelectedValue
  </code></pre>
  
  <p>....</p>
  
  <p>and the SendEmail() is</p>
  
  <pre><code>Protected Sub SendEmail(ByVal rblnewqst1 As Object, ByVal rblnewqst2 As Object, ByVal rblnewqst3 As Object, ByVal rblnewqst4 As Object, ByVal rblnewqst5 As Object)
  
      If rblnewqst1.SelectedValue = 2 Or rblnewqst2.SelectedValue = 2 Or rblnewqst3.SelectedValue = 2 Or rblnewqst4.SelectedValue = 2 Or rblnewqst5.SelectedValue = 2 Then
  
          Dim sResponseFromName As String = "ex@example.com"
          Dim sResponseToName As String = txtEmail.Text
          Dim sResponseSubject As String = "Denied"
          Dim sResponseBody As String = "Message&gt;"
  
  
          Try
              Dim mm As New MailMessage(sResponseFromName, sResponseToName)
              Dim SMTP As New SmtpClient
  
              SMTP.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
  
              mm.Subject = sResponseSubject
              mm.Body = sResponseBody
              mm.IsBodyHtml = True
  
              Try
  
                  SMTP.Send(mm)
  
              Catch exSmtpException As SmtpException
                  Dim stemp As String = exSmtpException.Message.ToString
              End Try
  
          Catch ex As ApplicationException
              Dim stemp As String = ex.InnerException.Message.ToString
          End Try
  
      Else
          Dim sResponseFromName As String = "ex@example.com"
          Dim sResponseToName As String = txtEmail.Text
          Dim sResponseSubject As String = "Accepted"
          Dim sResponseBody As String = "MESSAGE....."
  
          Try
              Dim mm As New MailMessage(sResponseFromName, sResponseToName)
              Dim SMTP As New SmtpClient
  
              SMTP.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
  
              mm.Subject = sResponseSubject
              mm.Body = sResponseBody
              mm.IsBodyHtml = True
  
              Try
  
                  SMTP.Send(mm)
  
              Catch exSmtpException As SmtpException
                  Dim stemp As String = exSmtpException.Message.ToString
              End Try
  
          Catch ex As ApplicationException
              Dim stemp As String = ex.InnerException.Message.ToString
          End Try
      End If
  
  End Sub
  </code></pre>