Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET File I/O and Registry (http://www.xtremevbtalk.com/-net-file-i-o-and-registry/)
-   -   Filter List view (http://www.xtremevbtalk.com/-net-file-i-o-and-registry/326679-filter-list-view.html)

CJacob 12-16-2013 08:29 PM

Filter List view
Here's my code. How can i filter the listview? The items from the list view is from ms access.


Sub searchlstv()
        conn = New ADODB.Connection
        constr = ("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & Application.StartupPath & "\Database3.mdb")
        Dim rs100 As New ADODB.Recordset
        Dim rs2 As New ADODB.Recordset
        rs100.Open("SELECT * FROM tbl_doc_info", conn, ADODB.CursorTypeEnum.adOpenDynamic)
        If Not TextBox1.Text = "" Then
        End If
        If Not TextBox2.Text = "" Then
            Dim a As String = Nothing
            Dim itm As ListViewItem = Nothing
            Do Until rs100.EOF
                If rs100.Fields("docrevno").Value.ToString.ToLower Like CStr("*" & TextBox2.Text.ToLower & "*") Then
                    rs2.Open("SELECT * FROM tbl_files_info WHERE docno LIKE '" & (CStr(rs100.Fields("docno").Value)) & "'", conn, ADODB.CursorTypeEnum.adOpenDynamic)
                    With ListView1
                        itm =  .FindItemWithText(CStr(rs100.Fields("docno").Value.ToString), False, 0, True)
                        If Not itm Is Nothing Then
                            .Items.Item(itm.Index).Selected = True
                        End If
                    End With
                    itm = Nothing
                End If
        End If

This code doesn't filter the listview.

Gruff 12-18-2013 10:18 AM

Your question is confusing.
You posted this under VB.NET when your code looks like VB6 or VBA code.

Further you posted in the sub forum area "File IO and Registry" when this appears to have nothing to do with those topics.

You are addressing the wrong audience as far as I can see.

All times are GMT -6. The time now is 10:46 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.