资源简介
C# 动态复制多个文件的源码,高手跳过
C# 动态复制多个文件的源码,高手跳过

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//download by http://www.codefans.net
using System.IO;
namespace Case09_9
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender EventArgs e)
{
if (textBox2.Text != ““)
{
foreach (object o in listBox1.SelectedItems) //利用foreach循环把源目录中选择的文件复制到目标文件夹中
{
File.Copy(textBox1.Text + “\\“ + o.ToString() textBox2.Text + “\\“ + o.ToString());
}
int myx = listBox1.SelectedItems.Count; //复制文件的个数
string mystr = “已成功复制“ + myx.ToString() + “个文件“;
MessageBox.Show(this mystr “信息提示“ MessageBoxButtons.OK MessageBoxIcon.Information);
}
else
{
MessageBox.Show(this “目标文件夹不能为空!“ “信息提示“ MessageBoxButtons.OK MessageBoxIcon.Information);
}
}
private void button1_Click(object sender EventArgs e)
{
folderBrowserDialog1.ShowDialog(); //浏览文件夹对话框
textBox1.Text = folderBrowserDialog1.SelectedPath; //提取源目录路径及名称
if (textBox1.Text != ““)
{
DirectoryInfo dir = new DirectoryInfo(textBox1.Text);
FileInfo[] f = dir.GetFiles(); //提取源目录中所有文件
for (int i = 0; i < f.Length; i++)
{
listBox1.Items.Add(f[i]); //利用for循环添加到列表框中
}
}
else
{
MessageBox.Show(this “没有选择源文件夹!“ “信息提示“ MessageBoxButtons.OK MessageBoxIcon.Information);
}
}
private void button2_Click(object sender EventArgs e)
{
folderBrowserDialog1.ShowDialog(); //浏览文件夹对话框
textBox2.Text = folderBrowserDialog1.SelectedPath;
}
private void button4_Click(object sender EventArgs e)
{
this.Close();
Application.Exit();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
----------- --------- ---------- ----- ----
48655 16
相关资源
- Asp.net学生信息管理系统源码
- asp.net C#购物车源代码
- ASP.NET实验室预约管理系统
- 020ASP.NET车辆综合管理系统.zip
- c# 高校档案信息管理系统
- asp.net中c#做的躲避小游戏,希望大家
- ASP.NET C# 工资管理系统
- ASP.NET客户管理系统(毕业设计 C#
- 在线求职系统(C#ASP.NET源码)
- asp.net 在线考试系统及论文
- ASP.Net文件上传管理源码
- 《OA企业办公自动化》asp.net 源码(附
- asp.netc#开发规范
- asp.net 大文件上传(带进度条)
- 通过程序自动填充并提交ASP.NET表单(
- ASP.NET 基础编程文档(PPT电子教案)
-
ASP.NET_xm
l深入编程技术 - asp.net 新闻发布系统源码(附文档以及
- asp.net 简单的Ajax应用
- asp.net 企业官网源码(附数据库)
- asp.net 花语花店销售网站源码(含数据
- ASP.NET资产管理系统源码(附数据库)
- ajax 登录(基于asp.net)
- asp.net 简单新闻发布系统源码(附数据
- asp.net新闻发布系统(源码+数据库+论
- asp.net网上购物系统源码
- ASP.NET 在浏览器中预览文件
- asp.net 生命周期
- asp.net 花语花店销售网站源码(附数据
- asp.net 购物车实现(基于Session)
评论
共有 条评论