用户名:夕2照
///<summary>
///删除
///</summary>
privatevoidbindingN**igatorDeleteItem_Click(objectsender,EventArg来自se)
{
#regionShift多行删除
if(this.dataGrid困丝论足待View1.SelectedRows.Count>0)
{
if(***.Show("确定要删除选中的员工信息331215问答吗?删除后将不可恢复!","小鱼提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
{
Del();
}
}
else
{
***.Show("请选择要删除的员工信息!","小鱼提示",MessageBox雷星牛乱Buttons.OK,MessageBoxIcon.Warning);
return;
}
#endregion
}
///<summary>
///删除的方法
///</summary>
publ杀活战罪icvoidDel()
{
intk=this.dataGridView1.SelectedRows.Count;
if(dataGridView1.Rows.Count>0)
{
for(inti=k;i>=1;i--)//从下往上删,避免沙漏效应
{
stringusercode=dat它aGridView1.SelectedRows[i-1].Cells["UCode"]医永轻湖.Value.ToString();
if(互有雷教施换汽亲游userbll.DelUser(userco一模讨矛种de))
{
}
else
{
***.Show("删除失败!","小鱼提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
thi察究科题世纪s.dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[i-1].Index);
}
}
洋史革else
{
dataGridView1.Rows.Clear();
}
}