Results 1 to 7 of 7

Thread: Urgent please help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2007
    Location
    Ghana
    Posts
    120

    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.

  2. #2
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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.

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Urgent please help

    Quote Originally Posted by smUX View Post
    I'll point you in the right direction..
    better recheck your map (code) then.

    for b=1 to listbox.listcount ?

  5. #5
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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.

  6. #6
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Urgent please help

    Quote Originally Posted by smUX View Post
    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.

  7. #7
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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
  •  



Click Here to Expand Forum to Full Width