Results 1 to 9 of 9

Thread: Update Listbox like the one in start>Run

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    4

    Update Listbox like the one in start>Run

    How do i create a list box like the start menu>run command where as the user types a directory name the drop down displays the content of the directory and keeps on changing as the user types.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Update Listbox like the one in start>Run

    That would be a ComboBox, not a ListBox. Look at the properties whose names start with "AutoComplete" for that functionality.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    4

    Re: Update Listbox like the one in start>Run

    Thanks a Lot jmcilhinney, i was using a ComboList Box but didnt know that the autocomplete property did this, i was stupid enough to write code in keypress function of the ComboList Box.
    Theres just one more question, can i Filter the file type that are suggested to a particular extention ?? Like i want it to suggest and show only excel files, is that possible

  4. #4
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: Update Listbox like the one in start>Run

    Yes - its all possible. As jmcilhinney says - read up about the autocomplete source and autocomplete mode. That will give you the info you need to implement what you want.

  5. #5
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Update Listbox like the one in start>Run

    Code:
    comboBox1.AutoCompleteSource = AutoCompleteSource.FileSystemDirectories
    comboBox1.AutoCompleteMode = AutoCompleteMode.Suggest

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    4

    Re: Update Listbox like the one in start>Run

    Yes i have already done that, but i want that the dropdown should suggest excel files only.
    How do i filter the suggestion

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Update Listbox like the one in start>Run

    You'd have to use a custom source and get just the Excel files yourself, using Directory.GetFiles.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Update Listbox like the one in start>Run

    Take a look at this custom control from CodeProject, I think it's exactly what you're looking for.

    http://www.codeproject.com/KB/cpp/ExpCombo.aspx

  9. #9

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    4

    Re: Update Listbox like the one in start>Run

    Thank you jmcilhinney, keystone_paul and MaximilianMayrhofer for the help you've provided, i've been able to accomplish the task, thanks to your guidance.
    Thanks a Ton Again

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