using System;
using System.IO;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
private string[] files = Directory.GetFiles("\Files", "*.xlsx");
private int count = 0;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
foreach (string i in files)
{
count++;
}
textBox1.Text = count.ToString();
count = 0;
}
}
}