using System.IO;
namespace WindowsFormsApp79
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
string[] apaths = Directory.GetDirectories(Environment.SystemDirectory);
foreach (string dirPath in apaths) {
listBox1.Items.Add(dirPath);
}
}
private void button2_Click(object sender, EventArgs e)
{
listBox2.Items.Clear();
string[] afiles = Directory.GetFiles(Environment.SystemDirectory, "*.*");
foreach (string file in afiles) {
listBox2.Items.Add(file);
}
}
}
}