public void execute(Form hander) { MainForm mf = hander as MainForm; if (mf != null && mf.dataGridView1.RowCount > 0) { int i = mf.dataGridView1.CurrentRow.Index; DataRowView drv = (DataRowView)mf.dataGridView1.Rows[i].DataBoundItem; String id = drv["orderlistid"].ToString(); saleOrderService.deleteList(id); mf.dataGridView1.DataSource = saleOrderService.getOrderListByOrderId(SystemInfo.CurrentOrderId); mf.presenter.setCurrentOrder(); mf.presenter.selectLastRow(); } }