Results 1 to 2 of 2

Thread: Remove lines from list box based on a desired specific keyword

  1. #1

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

    Remove lines from list box based on a desired specific keyword

    Hello guys,
    I would be very grateful as usual if you could help me on this one.
    Lets say I have a Listbox containing the a number of items - say filepaths and so on. Now I would want to be able to loop through and remove specific lines/items from the list box based on the keyword I offer. Perhaps this should be in a form of a function or something so that
    For example, if I want to remove all entries which has the word "#EXT" or a symbol, all such entries would be removed.
    I would be very grateful for a practical demonstration.
    Thanx.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Remove lines from list box based on a desired specific keyword

    A simple For:Next loop will work. But work in reverse from .ListCount-1 To 0 Step -1
    For each list item within that loop, use InStr() on the .List(n) property to see if the criteria exists & if so, remove it.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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