我尝试使用组合框将文件夹从C:\ folderX \ folderY驱动器复制到可移动驱动器:\ folderName \ 组合框选择要将文件复制到的目标驱动器。 到目前为止,我的代码
using System.IO;
namespace OptimaBackup
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
getdrive();
}
private void getdrive()
{
string[] driv = Directory.GetLogicalDrives();
foreach (string item in driv)
{
comboBox1.Items.Add(item.ToString());
}
}
private void button1_Click(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string getinfo = comboBox1.SelectedItem.ToString();
DriveInfo drinfo = new DriveInfo(getinfo);
string drivety = drinfo.DriveType.ToString(); //this for copy to usb drive
{
MessageBox.Show(" The File is copy To " );
}
}
// this is for copy from usb drive to C drive
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}