|
-
May 16th, 2000, 05:11 PM
#1
Thread Starter
Addicted Member
Hi there guys, i need some help for a project i am working on. I need to create a feature that will enable the user to start typing a word and in a list box show matching results. The feature i would like it to be based around is the windows help system "The Index Search".....
I have a screen dump of the layout if you would like it...
send me some mail please.....
Rohan
-
May 16th, 2000, 05:28 PM
#2
Fanatic Member
Where are grabbing the information from ?
Is it from a Database or is it static?
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
May 16th, 2000, 05:35 PM
#3
Thread Starter
Addicted Member
I am not sure, what do you think
if you look at a windows help system you can see how that works. I am not sure but i can send you a picture
-
May 16th, 2000, 05:44 PM
#4
Fanatic Member
If you grab the words from a database, you can set an onchange event of the text box that the user is entering then each time it does, change the row source of the list box to lstbox.rowsource = "SELECT * FROM tbltest WHERE name LIKE '" & txtsearch & "*'"
Hope this helps
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
May 16th, 2000, 08:54 PM
#5
Thread Starter
Addicted Member
Awesome answer
Thanks Ian, awesome idea.....
Rohan
-
May 16th, 2000, 09:53 PM
#6
You can use a simple SendMessage API to achiev exactly what you want. Let's assume that you have a ListBox and a TextBox where you type in your search text:
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_FINDSTRING = &H18F
Private Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, -1, ByVal (Text1.Text))
End Sub
When you type into the Textbox, it will search the Listbox for the string you typed in. If it finds it, then it will select that list item.
-
May 16th, 2000, 10:15 PM
#7
Fanatic Member
I bow down to the great Guru Serge, I forgot about that API 
All credit
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
May 17th, 2000, 03:09 AM
#8
Lively Member
Will this also work for a listview ?
-
May 18th, 2000, 01:17 AM
#9
For ListView you can use ListView's FindItem method:
Code:
Private Sub Command1_Click()
Dim itmX As ListItem
Set itmX = ListView1.FindItem("MyWord", , , lvwPartial)
If Not itmX Is Nothing Then
ListView1.SetFocus
itmX.Selected = True
itmX.EnsureVisible
End If
End Sub
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
|