//输入框控制事件 private void TextKeyUp(object sender, KeyEventArgs e) //KeyEventArgs { int nkey = Convert.ToInt32(e.KeyCode); Control control = (Control)sender; if (control.Text.Trim() == "") { control.Text = ""; control.Tag = "0"; } if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == ""))) { } else { return; } try { Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 3); switch (control.TabIndex) { case 0: if (control.Text.Trim() == "") { return; } if (_menuTag.Function_Name.Trim() == "Fun_ts_yf_ypptrk_qtrk") { Yp.frmShowCard(sender, ShowCardType.供货单位, 0, point, InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase); if (Convertor.IsNull(control.Tag, "0") != "0") { this.SelectNextControl((Control)sender, true, false, true, true); } } else { Yp.frmShowCard_funName(sender, ShowCardType.单据往来科室, _menuTag.Function_Name, point, InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase); if (Convertor.IsNull(control.Tag, "0") != "0") { this.SelectNextControl((Control)sender, true, false, true, true); } } break; } } catch (System.Exception err) { MessageBox.Show("发生错误" + err.Message); } }
private void txtsccj_KeyUp(object sender, KeyEventArgs e) { int nkey = Convert.ToInt32(e.KeyCode); Control control = (Control)sender; if (control.Text.Trim() == "") { control.Text = ""; control.Tag = "0"; } if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convertor.IsNull(control.Tag, "0") == "0" || Convertor.IsNull(control.Tag, "0") == ""))) { } else { return; } Point point = new Point(this.Location.X + control.Location.X, this.Location.Y + control.Location.Y + control.Height * 2); string ssql = ""; if (nkey == 13 && (control.Tag.ToString() != "" && control.Tag.ToString() != "0")) { return; } Yp.frmShowCard(sender, ShowCardType.厂家, 0, point, _deptid, _DataBase); if (Convertor.IsNull(control.Tag, "0") != "0") { this.SelectNextControl((Control)sender, true, false, true, true); } Ypcj cj = new Ypcj(_cjid, _DataBase); FillYP(0, cj.GGID); txtpfj.Focus(); txtpfj.SelectAll(); }