public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.openFile.Multiselect = true;
}
private void DeleteFile(string paramPath)
{
string Path = paramPath.Substring(paramPath.LastIndexOf("\\") + 1);
if (System.IO.File.Exists(paramPath))
{
if (MessageBox.Show("Whether delete? \n" + Path + "\t", "Hint", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
{
return;
}
else
{
File.Delete(paramPath); MessageBox.Show("The document deletes success!");
}
}
else
{
MessageBox.Show("The document done not want to delete !");
}
} private void btnDelete_Click(object sender, EventArgs e)
{
if (this.openFile.ShowDialog() == DialogResult.OK)
{
string paramPath = this.openFile.FileName;
this.txtShow.Text = paramPath;
this.DeleteFile(paramPath);
}
}
}
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.openFile.Multiselect = true;
}
private void DeleteFile(string paramPath)
{
string Path = paramPath.Substring(paramPath.LastIndexOf("\\") + 1);
if (System.IO.File.Exists(paramPath))
{
if (MessageBox.Show("Whether delete? \n" + Path + "\t", "Hint", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
{
return;
}
else
{
File.Delete(paramPath); MessageBox.Show("The document deletes success!");
}
}
else
{
MessageBox.Show("The document done not want to delete !");
}
} private void btnDelete_Click(object sender, EventArgs e)
{
if (this.openFile.ShowDialog() == DialogResult.OK)
{
string paramPath = this.openFile.FileName;
this.txtShow.Text = paramPath;
this.DeleteFile(paramPath);
}
}
}
解决方案 »
- 两张表和一个存储过程引发的血案
- System.OutOfMemoryException
- 问一个关于 SqlConnection/OleDbConnection 的打开与关闭时机话题,以及datareader的一些问题.
- 5星问题:点击Button B如何触发Button A的Click事件?
- sql2000和C#
- 如何实现把一个结构体变量中存储的所有数据作为一个整体存储到一个byte数组中啊?
- 程序下载图片 下载图片 远程服务器返回错误: (403) 已禁止。
- Httphandler ~~~~~~~~~~~~~~求救 高手!
- 怎样用程序检测用户.NET版本?在1.1版本显示乱码?
- 高手推荐几个好的C#的网站把!
- 请问各位,如何用C#制作一个可以由VB.net程序调用的控件?
- VS2005运行故障
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.openFile.Multiselect = true;
}
private void DeleteFile(string[] str)
{
//string Path = paramPath.Substring(paramPath.LastIndexOf("\\") + 1);
foreach (string FliePath in openFile.FileNames)
{
if (System.IO.File.Exists(FliePath))
{
if (MessageBox.Show("Whether delete? \n" + FliePath, "Hint", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
{
continue;
}
else
{
File.Delete(FliePath);
}
}
//else
//{
// MessageBox.Show("The document done not want to delete !");
//}
}
MessageBox.Show("The document deletes success!");
} private void btnDelete_Click(object sender, EventArgs e)
{
if (this.openFile.ShowDialog() == DialogResult.OK)
{
string[] FliePath = this.openFile.FileNames;
this.DeleteFile(FliePath);
}
}
下午已经解决了3Q!!!!