|
-
Jan 4th, 2010, 03:24 PM
#1
Thread Starter
Lively Member
Urgent please help
Hello fellow programmers. Happy new year to you all. I have little problem with how to go about the following.
I want to be able to search a file name amongst filepaths
For example i have a listbox containing the following paths
C:\new folder\music\track1.mp3
C:\new folder\music\Akon.mp3
C:\new folder\music\BenFolds.mp3
C:\new folder\music\Dexter.mp3
And i need to search and highlight the prefered item from a textbox. Lets say
I type in akon in a textbox so that the akon path is selected.
How do I do that?
I really need your help on this one too.
I would be very grateful as usual. Thank you all.
-
Jan 4th, 2010, 03:27 PM
#2
PowerPoster
Re: Urgent please help
I'll point you in the right direction...
Code:
for b=1 to listbox.listcount
if instr(listbox.List(b),"Akon")<>0 then debug.print "line" & str(b)
next b
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jan 5th, 2010, 08:51 AM
#3
Re: Urgent please help
Something like this: 
Code:
Option Explicit
Private Sub Command1_Click()
Dim strText As String
Dim i As Integer
strText = "Akon"
For i = 0 To List1.ListCount - 1
If InStr(UCase(List1.List(i)), UCase(strText)) <> 0 Then List1.ListIndex = i
Next i
End Sub
Private Sub Form_Load()
List1.AddItem "C:\new folder\music\track1.mp3"
List1.AddItem "C:\new folder\music\Akon.mp3"
List1.AddItem "C:\new folder\music\BenFolds.mp3"
List1.AddItem "C:\new folder\music\Dexter.mp3"
End Sub
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Jan 5th, 2010, 11:33 AM
#4
Re: Urgent please help
 Originally Posted by smUX
I'll point you in the right direction..
better recheck your map (code) then. 
for b=1 to listbox.listcount ?
-
Jan 5th, 2010, 11:34 AM
#5
PowerPoster
Re: Urgent please help
I don't see anything wrong with the code...although I did write it outside of the programming environment so minor things might be in there :-P
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jan 5th, 2010, 11:50 AM
#6
Re: Urgent please help
 Originally Posted by smUX
I don't see anything wrong with the code...although I did write it outside of the programming environment so minor things might be in there :-P
just for the newbies, should be, 0 to .listcount - 1
The first item in the list is ListIndex 0, and the value of the ListCount property is always one more than the largest ListIndex value.
-
Jan 5th, 2010, 12:02 PM
#7
PowerPoster
Re: Urgent please help
Ah...I rarely use listboxes, I don't like them...I think you see why :-)
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
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
|