/// <summary> /// 新增按钮事件 /// </summary> public void btnNew_Click(object sender, EventArgs e) { try { DataRow dr = masterDataSet.Tables[0].NewRow(); masterDataSet.Tables[0].Rows.Add(dr); masterBindingSource.MoveLast(); if (NewAfter != null) { NewAfter(); } newState = true; Set_Button_State(false); Set_EditZone_ControlReadOnly(false); pnlButton.Focus(); if (masterEditPanel != null) { masterEditPanel.SelectNextControl(null, true, true, true, true); } } catch (Exception ex) { //ExceptionHandler.HandleException(this.Text + "--新增按钮事件错误。", ex); ExceptionHandler.HandleException(this.Text + "--" + f.tsmiXzansj.Text, ex); } }
/// <summary> /// 新增按钮事件 /// </summary> public void btnNew_Click(object sender, EventArgs e) { try { if (!FrmMainDAO.QueryUserButtonPower(this.ParentForm.Name, this.Text, sender, true)) { return; } if (NewBefore != null) { if (!NewBefore()) { return; } } DataRow dr = masterDataSet.Tables[0].NewRow(); if (DataRowInsertBottom) { masterDataSet.Tables[0].Rows.Add(dr); masterBindingSource.MoveLast(); } else { masterDataSet.Tables[0].Rows.InsertAt(dr, 0); masterBindingSource.MoveFirst(); } if (NewAfter != null) { NewAfter(); } newState = true; Set_Button_State(false); Set_EditZone_ControlReadOnly(false); pnlButton.Focus(); if (masterEditPanel != null) { masterEditPanel.SelectNextControl(null, true, true, true, true); } } catch (Exception ex) { //ExceptionHandler.HandleException(this.Text + "--新增按钮事件错误。", ex); ExceptionHandler.HandleException(this.Text + "--" + f.tsmiXzansj.Text, ex); } }