|
-
Sep 22nd, 2005, 01:22 PM
#1
Thread Starter
New Member
[RESOLVED] help..autosearch listview
hi..
how do I autosearch from listview.
for example:
when I type 'A' into the textbox, all the word that begin with 'A' will appear in the listview.... 
TQ..
-
Sep 22nd, 2005, 02:12 PM
#2
Re: help..autosearch listview
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 22nd, 2005, 02:20 PM
#3
Re: help..autosearch listview
i just whipped up a sample for a listview
VB Code:
Dim WordList() As String
Private Sub Form_Load()
ListView1.ListItems.Add , , "AAA"
ListView1.ListItems.Add , , "AAB"
ListView1.ListItems.Add , , "ABB"
ListView1.ListItems.Add , , "BBA"
ListView1.ListItems.Add , , "BBC"
ListView1.ListItems.Add , , "DDE"
ListView1.ListItems.Add , , "FFF"
ListView1.ListItems.Add , , "FFG"
ListView1.ListItems.Add , , "RRR"
ReDim WordList(0)
For x = 1 To ListView1.ListItems.Count
WordList(x - 1) = ListView1.ListItems(x).Text
If x <> ListView1.ListItems.Count Then ReDim Preserve WordList(UBound(WordList) + 1)
Next
End Sub
Private Sub Text1_Change()
ListView1.ListItems.Clear
For x = 0 To UBound(WordList)
If Text1 = "" Then
ListView1.ListItems.Add , , WordList(x)
Else
If LCase(Left(WordList(x), Len(Text1))) = LCase(Text1) Then
ListView1.ListItems.Add , , WordList(x)
End If
End If
Next
End Sub
this is with the listview set to 2-lvwList for the view setting
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 22nd, 2005, 02:23 PM
#4
Re: help..autosearch listview
This looks pretty slick. I have to go to a meeting but I'm gonna bookmark this and try it out later.
-
Sep 22nd, 2005, 03:13 PM
#5
Thread Starter
New Member
Re: help..autosearch listview
 Originally Posted by [A51g]Static
i just whipped up a sample for a listview
VB Code:
Dim WordList() As String
Private Sub Form_Load()
ListView1.ListItems.Add , , "AAA"
ListView1.ListItems.Add , , "AAB"
ListView1.ListItems.Add , , "ABB"
ListView1.ListItems.Add , , "BBA"
ListView1.ListItems.Add , , "BBC"
ListView1.ListItems.Add , , "DDE"
ListView1.ListItems.Add , , "FFF"
ListView1.ListItems.Add , , "FFG"
ListView1.ListItems.Add , , "RRR"
ReDim WordList(0)
For x = 1 To ListView1.ListItems.Count
WordList(x - 1) = ListView1.ListItems(x).Text
If x <> ListView1.ListItems.Count Then ReDim Preserve WordList(UBound(WordList) + 1)
Next
End Sub
Private Sub Text1_Change()
ListView1.ListItems.Clear
For x = 0 To UBound(WordList)
If Text1 = "" Then
ListView1.ListItems.Add , , WordList(x)
Else
If LCase(Left(WordList(x), Len(Text1))) = LCase(Text1) Then
ListView1.ListItems.Add , , WordList(x)
End If
End If
Next
End Sub
this is with the listview set to 2-lvwList for the view setting
I have few colums in both of my listview..but i just need to display some colums from the first listview to the second one..
I am new to vb so I don't really see how I can modified your code.....
-
Sep 22nd, 2005, 03:50 PM
#6
Re: help..autosearch listview
remove the stuff about the Wordlist()
just use this:
VB Code:
Private Sub Text1_Change()
ListView2.ListItems.Clear
For x = 1 To ListView1.ListItems.Count
If Text1 = "" Then
ListView2.ListItems.Add , , ListView1.ListItems(x).Text
Else
If LCase(Left(ListView1.ListItems(x).Text, Len(Text1))) = LCase(Text1) Then
ListView2.ListItems.Add , , ListView1.ListItems(x).Text
End If
End If
Next
End Sub
you will need to add subitems as weel for each of your columns, but this should get you going ! (I hope)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 22nd, 2005, 04:06 PM
#7
Thread Starter
New Member
Re: help..autosearch listview
Thanks [A51g]Static..
I already find the solution myself...its almost the same as yours
-
Sep 23rd, 2005, 07:04 AM
#8
Re: help..autosearch listview
 Originally Posted by yatt
Thanks [A51g]Static..
I already find the solution myself...its almost the same as yours

Post your solution and share it with the rest of us.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|