


public void listFolders(ComboBox tscb)//获取本地磁盘目录
{
string[] logicdrives = System.IO.Directory.GetLogicalDrives();//获取本地逻辑分区的数组
for (int i = 0; i < logicdrives.Length; i++)//遍历数组
{
tscb.Items.Add(logicdrives[i]);//将数组中的项目添加到ComboBox控件中
tscb.SelectedIndex = 0;//设置第一项被选中
}
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
listFolders(comboBox1);
}



亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论