Answer the question
In order to leave comments, you need to log in
WITH#. You need to select a folder so that the program subsequently processes all the files available there, how can it be implemented?
The task is to open a dialog box, select a folder and then the program processes certain files in it. I solved this problem in this way:
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Clear();
//FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
//DialogResult result = folderBrowserDialog1.ShowDialog();
using (var folderBrowserDialog1 = new FolderBrowserDialog())
{
//folderBrowserDialog1.Filter = "Png Files (*.png)|*.png";
//fldrDlg.Filter = "Excel Files (*.xls, *.xlsx)|*.xls;*.xlsx|CSV Files (*.csv)|*.csv
List<string> a = new List<string>();
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
Directory.GetFiles(folderBrowserDialog1.SelectedPath, "ALARMHST*.txt", SearchOption.AllDirectories).ToList().ForEach(f => a.Add(f));
//Directory.GetFiles(folderBrowserDialog1.SelectedPath).ToList().ForEach(f => a.Add(f));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question