实现效果:
知识运用:
DirectoryInfo类的Create方法
string对象的EndsWith方法
实现代码:
private void button1_Click(object sender, EventArgs e) { FolderBrowserDialog FBDialog = new FolderBrowserDialog(); if (FBDialog.ShowDialog() == DialogResult.OK) { string strPath=FBDialog.SelectedPath; if (strPath.EndsWith("\\")) textBox1.Text = strPath; else textBox1.Text = strPath + "\\"; } } private void button2_Click(object sender, EventArgs e) { DirectoryInfo Dinfo = new DirectoryInfo(textBox1.Text+textBox2.Text); Dinfo.Create(); }
原文:https://www.cnblogs.com/feiyucha/p/10236621.html