Mimic/Create Minimalist File Browser in C# -
i'm trying make program stores files *.txt
based documents. want able click button , pull list of stored files
(located in c:\programdata\programname\incidents)
above example of i'm trying accomplish 140219-000727
name of file, rest isn't need. clicking open or double clicking "open" file , parse .txt pre-existing forms on winform application have created.
what best way go doing minimal hit on system resources?
i think directory.getfiles
looking for. can use simplest mask "*.txt" fetch txt files , using path.getfilename
cut file name full path. , later (on double click or button click) use directory name + file name opening:
//populating: var files = directory.getfiles(your_folder_path, "*.txt"); foreach (var file in files) { var filename = path.getfilename(file); //assuming listbox: listbox.items.add(filename); } //opening (from listbox) var filename = path.combine(your_folder_path, listbox.selecteditem.tostring()); file.readalltext(filename);
Comments
Post a Comment