Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my code. I am new to Vb.net. This must be very simple but couldn't figure it out quickly


Dim LinID() As String = Nothing

VB
If dsLit.Tables(0).Rows.Count > 0 Then
         For Each i As Int16 In dsLit.Tables(0).Rows
           LinID(i) = dsLit.Tables(0).Rows(i)("LILTID").ToString().Trim()
         Next
       End If



Can anyone help me with this?
I want value from Datable to store in array. If there are 5 items in Datatable it should store 5 string values in LinID array
Posted

1 solution

Try:
VB
Dim list As New List(Of String)()
For Each row As DataRow In dsLit.Tables(0).Rows
    list.Add(row("LILTID").ToString().Trim())
Next
Dim LinId As String() = list.ToArray()
 
Share this answer
 
Comments
sudevsu 23-Feb-15 13:11pm    
Thank you OG
OriginalGriff 23-Feb-15 14:03pm    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900