Filter List view
Filter List view
Filter List view
Filter List view
Filter List view
Filter List view Filter List view Filter List view Filter List view Filter List view Filter List view Filter List view Filter List view
Filter List view Filter List view
Filter List view
Go Back  Xtreme Visual Basic Talk > > > Filter List view


Reply
 
Thread Tools Display Modes
  #1  
Old 12-16-2013, 09:29 PM
CJacob CJacob is offline
Newcomer
 
Join Date: Nov 2013
Posts: 2
Question Filter List view


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

Code:
Sub searchlstv()
        ListView1.BeginUpdate()
        conn = New ADODB.Connection
        constr = ("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & Application.StartupPath & "\Database3.mdb")
        conn.Open(constr)
        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
            rs100.MoveFirst()
            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
                    rs2.Close()
                End If
                rs100.MoveNext()
            Loop
         
        End If
This code doesn't filter the listview.

Last edited by CJacob; 12-16-2013 at 11:11 PM.
Reply With Quote
  #2  
Old 12-18-2013, 11:18 AM
Gruff's Avatar
GruffFilter List view Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

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.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
Reply

Tags
filter listview, listview, vb.net


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Filter List view
Filter List view
Filter List view Filter List view
Filter List view
Filter List view
Filter List view Filter List view Filter List view Filter List view Filter List view Filter List view Filter List view
Filter List view
Filter List view
 
Filter List view
Filter List view
 
-->