首页互联网dialogresult(C DialogResult的用法)

dialogresult(C DialogResult的用法)

编程之家2024-01-29107次浏览

一、c#用OpenFileDialog打开的文件复制到别的目录上

//先获取文件路径 try { openFileDialog1.Multiselect=true;//可以选择多个文件 if(this.openFileDialog1.ShowDialog()==DialogResult.OK) { foreach(stringfileinopenFileDialog1.FileNames) { textBox4.Text=Path.GetFileName(file);//获取文件名 //name=fileName; this.textBox2.Text=openFileDialog1.FileName;//获取文件名以及路径 } } } catch(Exceptionex) { MessageBox.Show(ex.Message); } ------------------------ 获取源文件路径和复制保存的文件路径,关于保存多个,可能要用到数组. if(textBox2.Text==""||textBox3.Text=="") { MessageBox.Show("无效路径"); } else { File.Copy(textBox2.Text,textBox3.Text); MessageBox.Show("复制成功"); } ------------- 这个比较合适初学者用.

dialogresult(C DialogResult的用法)

二、C#的OpenFileDialog怎么用

简单版本的privatevoidbutton1_Click(objectsender,EventArgse){OpenFileDialogop=newOpenFileDialog();stringpath="";if(op.ShowDialog()==DialogResult.OK){path=op.FileName;}pictureBox1.Load(path);}

dialogresult(C DialogResult的用法)
solaris(solaris官网)netsh(netsh命令解析与实例使用)