20 | 09 | 2017

Search within Datatable

TO search for a value within a datatable use the code below:

Dim Tbl as DataTable =  '(Specify datatable here)

Dim SearchString As String = "TypeSearchStringHere"   'String to search for within datatable
Dim rowfound As DataRow =TBL.Rows.Find(SearchString )

If rowfound IsNot Nothing Then
    MsgBox(rowfound (1).ToString())  'Resturns the first value of the found row(s). 
    MsgBox("A row with value " & SearchString  & " has not be found")
End If

Sign up now and upload your code to the website.

Help us to continue.....
Articles View Hits
Latest Articles