Results 1 to 9 of 9

Thread: How do I build a variable search form?

Threaded View

  1. #1

    Thread Starter
    Lively Member Christhemist's Avatar
    Join Date
    Sep 2016
    Location
    Nevada
    Posts
    116

    How do I build a variable search form?

    I am trying to build a search form that loops through my data, searching for what would be a wide variety of criteria. I want to include "AND/OR" operators but I cannot discern a logical way of approaching this. Here is what the search box would look like, but how would I go about looping through each line to search my data by the given criteria?

    Criteria to loop through:

    Firstname = John
    or
    Firstname = Paul
    and
    Lastname = Smith

    So, basically I would like to loop through my data and find anyone named John Smith or Paul Smith.

    Here is some futile attempt at doing this:

    Code:
     For Each strLine As String In TextBox2.Text.Split(vbNewLine)
                Dim SearchFor As String = strLine.ToString
    
                If SearchFor = vbLf & "AND" Or SearchFor = vbLf & "OR" Then
    
                End If
    
                For Each dr As DataRow MyDataTable.Rows
                    If MyDataTable.Rows(RowNumber)(ColumnName) = ItemToFind Then
    
                    End If
                Next
    
            Next
    Also, the "=" operator is subject to change. It could be something like this as well:

    RecordNumber > 1000
    And
    RecordNumber < 2000
    Last edited by Christhemist; Nov 17th, 2016 at 02:53 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width