2012년 3월 19일 월요일

작업할 폴더를 선택해서 작업할 파일목록을 불러오기


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
            string aa = folderBrowserDialog1.SelectedPath;

            if (Directory.Exists(aa))
            {
                foreach (string f in Directory.GetFiles(aa))
                {
                    listBox1.Items.Add(f);
                }
            }
           
        }
    }
}

listbox에 지정경로의 파일목록을 불러온다.

댓글 없음 :

댓글 쓰기