0

I have a ComboBox automatically list all the HTML files located in the same directory as my application. But I can't figure out how to update the Combobox in realtime while the application is running if a new HTML file is added to the directory.

string path = AppDomain.CurrentDomain.BaseDirectory;
string[] filePaths = Directory.GetFiles(path, "*.html");
foreach (string file in filePaths)
{
    HTMLFiles.Items.Add(Path.GetFileName(file));
}

How can I update this to add new HTML files in realtime?

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
  • 1
    [FileSystemWatcher Class](https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx). – 001 Dec 06 '17 at 20:11
  • 1
    Are you struggling with getting the list of files, or the presentation of the file names in a combobox? If the latter are you using WPF, WinForms, etc? – LordWilmore Dec 06 '17 at 20:12

0 Answers0