YHDown 0 Newbie Poster

i have a gridview with values and email addresses. it sends emails to the email addresses if it is checked (checkbox).

i use arraylist to store the email addresses and the values in the rows as content in email.

how to check through the arraylist?

if the 1st address is same as 2nd address then values are stored until the addresses are different then email will be sent to that address and starts another value storing for another address.

my code is something like below:

For Each row As GridViewRow In GridView1.Rows
            Dim chk As CheckBox = DirectCast(row.Cells(9).FindControl("chkSelect"), CheckBox)
            lblPPN = DirectCast(row.FindControl("lblPPN"), Label)
            lblDate = DirectCast(row.FindControl("lblDate"), Label)
            lblRequestor = DirectCast(row.FindControl("lblRequestor"), Label)
            lblMPN = DirectCast(row.FindControl("lblMPN"), Label)
            lblMFR = DirectCast(row.FindControl("lblMFR"), Label)
            lblSupplier = DirectCast(row.FindControl("lblSupplier"), Label)
            lblSMPN = DirectCast(row.FindControl("lblSMPN"), Label)
            lblSMFR = DirectCast(row.FindControl("lblSMFR"), Label)
            lblLocalSupplier = DirectCast(row.FindControl("lblLocalSupplier"), Label)


            If chk.Checked Then

                strRequestor = lblRequestor.Text
                strPPN = lblPPN.Text
                strMPN = lblMPN.Text
                strMFR = lblMFR.Text
                strSupplier = lblSupplier.Text
                strSMPN = lblSMPN.Text
                strSMFR = lblSMFR.Text
                strLocalSupplier = lblLocalSupplier.Text


                emailist.Add(lblRequestor.Text)
                contentlist1.Add(strPPN)
                contentlist2.Add(strMPN)
                contentlist3.Add(strMFR)
                contentlist4.Add(strSupplier)
                contentlist5.Add(strSMPN)
                contentlist6.Add(strSMFR)
                contentlist7.Add(strLocalSupplier)
End If
Next

'ONE CHECKBOX CHECKED
 If emailist.Count = 1 Then
            For i = 0 To emailist.Count - 1
                PPN = contentlist1(i).ToString
                MPN = contentlist2(i).ToString
                MFR = contentlist3(i).ToString
                Supplier = contentlist4(i).ToString
                SMPN = contentlist5(i).ToString
                SMFR = contentlist6(i).ToString
                LocalSupplier = contentlist7(i).ToString
                body.Append("<p>Hi,</P>")
                body.Append("<p>This part has not been approved by customer.</p>")
                body.Append("PPN:" & PPN & "<br />")
                body.Append("MPN:" & MPN & "<br />")
                body.Append("MFR:" & MFR & "<br />")
                body.Append("Supplier:" & Supplier & "<br />")
                body.Append("Suggested MPN:" & SMPN & "<br />")
                body.Append("SUggested MFR:" & SMFR & "<br />")
                body.Append("Localized Supplier:" & LocalSupplier & "<br />")
                body.Append("<p>Thank You.</p>")
                sendemail(body, emailist(i).ToString, "Parts waiting for approval")
            Next
            body.Remove(0, body.Length)
        End If