• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

vb.net, need help in pass in parameter to function---absolute beginner

While ds.Tables(0).Rows.Count >= i
                            If ds.Tables(0).Rows.Count = i Then
                            item = item + "  " + tempDir.GetFiles("*.txt")(f).Name --- Storing item value in a variable, need to pass in this item value sendemail function
                            Exit While
                        End If
                        If (Mid(tempDir.GetFiles("*.txt")(f).Name, 1, tempDir.GetFiles("*.txt")(f).Name.Length - 19) = ds.Tables(0).Rows.Item(i)(0)) Then Exit While

                        i = i + 1
                    End While
                    f = f + 1
                End While
                'Exit Sub
                ''''' End If
                ' Next
                ProgressBar1.Value = 100
                MsgBox(item) --------------------How to call the sendemail function.
                ????? How to call the sendemail function here and how to pass in the item value to the below function
                ProgressBar1.Value = 0
                Exit Sub
                End If

Public Function SendEmail(....)   ----I dont know how pass the item from the above code to this function

Dim strEmail As String = "abc@yahoo.com.sg"

Dim strServer As String = ""

Dim strSubject As String = "Item missing"

Dim strBody As String

Dim mail As New MailMessage

Dim sm As SmtpMail

strBody = "The missing item is + ........"  How to add the above code item to here

mail.Cc = ""

mail.To = strEmail

mail.Subject = strSubject

mail.Body = strBody

mail.From = "service@yahoo.com.sg"

mail.BodyFormat = MailFormat.Html

sm.SmtpServer = strServer


End Function

Please help.................
  • 3
1 Solution
Éric MoreauSenior .Net ConsultantCommented:
Hi nyee84,

> Public Function SendEmail(....)
Public Function SendEmail(byval pMessage as string)

strBody = "The missing item is + ........"  How to add the above code item to here
strBody = "The missing item is : " + pMessage

Then call the method:

Éric MoreauSenior .Net ConsultantCommented:

BTW, you need to close your open questions by accepting comments! You have 19 questions that are still open.
Éric MoreauSenior .Net ConsultantCommented:
will you close your 18 other questions?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now