Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6766809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:52:32+00:00 2026-05-26T14:52:32+00:00

I have 2 functions, one is SaveData() and the other is SendEmail() in the

  • 0

I have 2 functions, one is SaveData() and the other is SendEmail()

in the SaveData() the radio buttons that are selected are saved, and the SendMail() is called at the end.

in the SendMail() the radio buttons are “tested” and then one of two emails is sent out based on the radio choices.

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()

The radio buttons are Yes/No questions

Any thoughts on why the parameters are not being passed?

Here is what I have:

Protected Function SaveData()
...
Q1 = Me.rblnewqst1.SelectedValue
        Q2 = Me.rblnewqst2.SelectedValue
        Q3 = Me.rblnewqst3.SelectedValue
        Q4 = Me.rblnewqst4.SelectedValue
        Q5 = Me.rblnewqst5.SelectedValue

….

and the SendEmail() is

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>"


        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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:52:33+00:00Added an answer on May 26, 2026 at 2:52 pm

    Like HardCode mentioned in his comments, I do recommend you always work with Option Explicit and Option Strict on.

    The first thing I would do is alter the way the SendMail part works, to take the values from the radio buttons. Your If is checking against and integer value, so I would use Integer as the type.

    So something more like:

    Protected Sub SendEmail(ByVal q1 As Integer, ByVal q2 As Integer)
    
    If q1 = 2 Or q2 = 2 Then
    etc...
    End IF
    

    I shortened the list so I didn’t have to type as much. In general I think it is better practice to send values than entire objects, unless you need the entire control for a specific reason. Also, sending object isn’t something I recommend doing unless you have no other choice.

    The other thing I would recommend, to test it, is setting a break point just inside the sendEmail Sub, use quick watch to see what the actual objects/types are that are being sent to your method that you are checking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 functions that needs to be executed one after the other. In
I have 4 functions that do something I feel one can do. function getDownline(rankid,
I have two functions, but one of the functions is only called from the
I have an StackOverflowException in one of my DB functions that I don't know
Possible Duplicate: jQuery delay between animations I have created two functions: One that animates
My problem is that I have two functions and one of the functions calls
i have two functions and one of them call the other one. I want
I have a div called MyDiv. How do I call 2 functions one after
I have two PHP functions - one that builds a html form and another
I need to have two functions which one is the alias of the other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.