private void DeleteFolder(string dir)
{
//循环删除文件夹 foreach(string d in Directory.GetFileSystemEntries(dir))
{
if(File.Exists(d))
File.Delete(d);//直接删除其中的文件
else
DeleteFolder(d);//递归删除子文件夹
} Directory.Delete(dir);//删除已空文件夹}

解决方案 »

  1.   

    是啊,删除CheckBox选上的行
    请问怎样具体做到,谢谢了
      

  2.   

    上边作废.错了private void BnCopy_Click(object sender, System.EventArgs e)
    {
    //复制所选
    string NewFolder=TxtNewFolder.Text; for (int i=0;i<DgList.Items.Count;i++)
    {
    if (((CheckBox)DgList.Items[i].Cells[0].FindControl("ChkSelect")).Checked)
    {
    string StrFullName=DgList.Items[i].Cells[3].Text;
    string StrName=StrFullName.Substring(StrFullName.LastIndexOf("\\")+1);
    string StrNewName=NewFolder+"\\"+StrName; if (File.Exists(StrFullName))
    {
    File.Copy(StrFullName,StrNewName,true);
    }
    else
    {
    DirectoryCopy(StrFullName,StrNewName,true);
    }
    }
    } DgListBind(LblCurrPath.Text);
    }---------------
    核心
    if (((CheckBox)DgList.Items[i].Cells[0].FindControl("ChkSelect")).Checked)
      

  3.   

    你说的是取得CheckBox选中时防会的值,那如何删除呢?
    谢谢了
      

  4.   

    private void BnDel_Click(object sender, System.EventArgs e)
    {
    int IntId=int.Parse(DgSaledDetail.DataKeys[i].ToString());
    for (int i=0;i<DgList.Items.Count;i++)
    {
    if (((CheckBox)DgList.Items[i].Cells[0].FindControl("ChkSelect")).Checked)
    {
                              string StrSql="delete from where id="+IntId;
                              ........... }
    }         重新绑定;}
      

  5.   

    DgSaledDetail与DgList写混了应该是同一个DataGrid的名字