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

VS 2008 [RESOLVED] how to use LIKE operator LINQ to query a datagridview

$
0
0
here is my code , but it is not working

Code:

Private Sub Txt_Search_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_Search.TextChanged

        Dim SearchStr As String = Me.Txt_Search.Text
        If SearchStr = "" Then
            Exit Sub
        Else
            SearchStr = String.Concat("%", SearchStr)
        End If


        Dim Sx = From Dr As DataGridViewRow In Me.DataGridView1.Rows _
                Where Dr.Cells(0).Value Like SearchStr _
                Select Dr.Index

        If Sx.Count <= 0 Then
            Exit Sub
        End If

        With Me.DataGridView1

            .Rows(Sx.ToList(0)).Selected = True
            .CurrentCell = .Rows(Sx.ToList(0)).Cells(0)
        End With


Viewing all articles
Browse latest Browse all 27224

Trending Articles



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