• anonymous
VB.NET : how do i get a combobox to load its info frm file names in a specified directory?
Computer Science
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • jamiebookeater
I got my questions answered at in under 10 minutes. Go to now for free help!
  • scign
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
  • anonymous
thanks...i tried it and posted it on DaniWeb....

Looking for something else?

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