• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • 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
            ds.Dispose()


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

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

sm.Send(mail)

End Function



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

Change:
> Public Function SendEmail(....)
To:
Public Function SendEmail(byval pMessage as string)

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

Then call the method:
SendMail(item)

Cheers!
0
 
Éric MoreauSenior .Net ConsultantCommented:
nyee84,

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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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