private void DvList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == colDel.Index) { if (MessageBox.Show("确定要删除吗?", "删除提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } try { var robot = dvList.CurrentRow.DataBoundItem as WeixinRobot; WeixinRobot.Delete(robot.Id); LoadRobot(); } catch (Exception ex) { MessageBox.Show("删除微信机器人失败:" + ex.ToString()); } } }