How can I make enumerated files from a directory added to a toolstrip menu item launchable?

  • Thread starter Thread starter _Sniffles_
  • Start date Start date
S

_Sniffles_

Guest
Hello :)

I have the following code which searches a directory and adds filenames to a toolstrip menu. The files present could be different all the time. I would really like to make it so that I can click on an item and open it with it's default program. I'm completely lost on how to make that happen in a dynamic way. Anyone have any idea? I'm using VS2017 15.7.5.

var filenames = from fullFilename
in Directory.EnumerateFiles(Application.StartupPath + "\\Custom\\", "*.*", SearchOption.AllDirectories)
select Path.GetFileName(fullFilename);

foreach (string filename in filenames)
{
toolStripMenuItem151.DropDownItems.Add(filename);
}

Continue reading...
 
Back
Top