Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2008 Rows to list or array select ? linq?

$
0
0
Code:

Public emailadd As New List(Of String)
    Public Function GetEmailAdd()
        If Table.Rows.Count <= 0 Then
            MsgBox("There is No Data")
        End If
        For Each row As DataRow In Table.Rows
            Dim email As String = (row(txttocol.Text))
            emailadd.Add(email)
        Next
        Return emailadd
    End Function

I am trying to populate a list of email addresses and what I have is working fine except for when I have a row with a blank field(no email address)

Not sure the best way to handle this and even if what I am currently doing is the best way to go about my program ie list etc...

This is how i later use the emails in the list

Code:

GetEmailAdd()
          For Each email In emailadd

I was thinking of only populating with my list of records that contained an email address and avoiding blanks not sure if linq or select statment is best method or another way?

Can someone help me with a select or linq statement or other idea

Thanks

Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>