Ray*_* M. 4 c# directory combobox
我希望你能帮我解决这个问题.
我一直在尝试使用特定目录的名称文件填充组合框.这个DIR将始终相同,因此它将始终是相同的例程.
有任何想法吗?
干杯!
string[] filePaths = Directory.GetFiles(@"c:\MyDir\", "*.txt");
foreach (string file in filePaths)
{
mycombobox.items.add(file);
}
Run Code Online (Sandbox Code Playgroud)
小智 5
初始化时执行以下操作:
private void Form1_Load(object sender, EventArgs e)
{
string[] files = System.IO.Directory.GetFiles(@"C:\Testing");
this.comboBox1.Items.AddRange(files);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18330 次 |
| 最近记录: |