By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,780 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,780 IT Pros & Developers. It's quick & easy.

search filter with textbox...

100+
P: 137
Hello,
I trying to make an program for my cd collection.
I wanted to insert all my cd's into a access database.
Then, with the program, i want to search for a title or artist.
So, my question is, how can i do that if i look for example" bon jovi - It's my live", i type in the textbox "bon jo" that he only display all the songs/artists with these letters at the right side.(i mean, on the left side the textbox and the right side the whole cd collection.).
If you use winamp, you know what i mean (J to jump to...)

Gr Paul
Oct 27 '06 #1
Share this Question
Share on Google+
5 Replies


100+
P: 267
hi

suppose all your cd's are listed in a listbox
this is the fastest way to find a name.

use:

Expand|Select|Wrap|Line Numbers
  1. Const LB_FINDSTRING = &H18F
  2. Const LB_FINDSTRINGEXACT = &H1A2
  3. Din LstNdx as Integer
  4.  
  5. Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As String) As Long
  6.  
in your delclaration.

then use:

Expand|Select|Wrap|Line Numbers
  1. LstNdx = SendMessage(lstCDs.hWnd, LB_FINDSTRING, -1, txtCDName.Text)
  2. ' to look up the listindex of the cd to find
  3. txtCDName.Text=lstCDs.List(LstNdx)
  4. ' to get the whole text
  5.  
if you call the code above from txtCDName_Change, the text will change after every keystroke (annoying)
better create a button to trigger the code.
or call from

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtCDName_KeyDown(KeyCode As Integer, Shift As Integer)
  2. if KeyCode=VBKeyReturn then
  3. txtCDName.Text=lstCDs.List(LstNdx)
  4. End If
  5.  
Oct 28 '06 #2

100+
P: 137
Hmm, this must be vb, isn't it?
I'm using/learning .Net.
Maybe you know how to do that?

Thanx
Paul
Oct 31 '06 #3

100+
P: 267
Hmm, this must be vb, isn't it?
I'm using/learning .Net.
Maybe you know how to do that?

Thanx
Paul
sry, no idea abt .net
haven been using vb6 since 8 years now and love it .. :)
Oct 31 '06 #4

100+
P: 137
okay, keep on the good work !
I will post it at .net forum.... sorry, didn't look to good!

Paul
Nov 11 '06 #5

P: 51
after 6 years ago..

'use adodc
'use datagrid
'put this code in the Sub of txtboxName_cange()

Dim strArtist As String
strArtist = Trim(txtboxName.text)
adodc1.doSql "select * from my_song_tbl where fld_artist_name like '"& strArtist &"%'"

'set the datagrid datasouce in adodc1
'waw.. trending topic.. hahaha.. :))
Mar 17 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.