C#获取文件夹下的所有文件名

 

 下面代码中:xxx代表指定的目录。

.zzz代表可查的扩展名

DirectoryInfo theFolder = new DirectoryInfo(@"xxx\xxxx\xxx");
    
//指定目录
            foreach (FileInfo nextFile in theFolder.GetFiles("*.zzz"))
            {
                
//添加到容器中,combobox listview
                comboBox1.Items.Add(nextFile.Name.Replace(".zzz"""));  
            }
posted @ 2008-11-25 10:12  wangbin5542  阅读(1917)  评论(0编辑  收藏  举报