开发者

How do I put a listing of files into a menu?

I have a folder with .txt files in it. How can i make my menuitem get those .tx开发者_如何学JAVAt files and put the filenames in the menuitem, so that it creates a list of all .txt files in that folder.

So when i put a .txt in the folder the program automatically creates the menu item.

Does someone knows how to do this, or perhaps an example?


Unless you're using ASP.Net, you're looking for the FileSystemWatcher and Directory classes.

Basically, you need to call Directory.GetFiles and loop through the results creating MenuItems.
Then, handle the FileSystemWatcher events and either rebuild the menu from scratch (simpler) or update the appropriate item (faster)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜