日期:2014-05-16 浏览次数:20809 次
public partial class Form1 : Form
{
string search;
delegate void setList();
setList set = null;
public Form1()
{
InitializeComponent();
}
private void Search()
{
set = delegate()
{
listView1.Clear();
search = textBox1.Text;
//searchFile(@"C:\WINDOWS\system32");
DirectoryInfo di = new DirectoryInfo(@"C:\WINDOWS\system32");
FileInfo[] f = di.GetFiles(search);
foreach (FileInfo fi in f)
listView1.Items.Add(fi.Name);
};
listView1.Invoke(set);
}
private void button2_Click(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(Search));
t.Start();
}
private void Search()
{
listView1.Clear();