A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 5 years ago

VB.NET : how do i get a combobox to load its info frm file names in a specified directory?

  • This Question is Closed
  1. scign
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The "Dir" function returns the contents of a specific directory. You call the function once with the directory name and relevant options, and it gives you the first one. Calling the function again with no parameters several times gives you the rest one by one and returns "" when there are no more. Make sure you have the slash at the end of the first call if you're only specifying the directory. You can also use wildcard characters (* and ?) to filter the results. So you need a loop. Set up a 'while' loop to read in all the files until you get a "" and as you get them, add them to the combobox. filename = Dir("C:\Directory\") ' set up the iteration Do While filename <> "" ' when filename is empty we're done Combo1.AddItem filename ' add the file to the combo box filename = Dir() ' get the next one - will return empty when finished Loop

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks...i tried it and posted it on DaniWeb.... http://www.daniweb.com/software-development/vbnet/threads/376595

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...


  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.