双击事件KeyPress
通过事件e检测输入字符, 当e.KeyChar == (char)13 时(13是回车,ASCII码13)
private void txtBatchID_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
if (e.KeyChar == (char)13)
{
if (txtBatchID.Text != "")
{
//CommonFunction.ClearGridView(grdItemList, true);
//CommonFunction.ClearGridView(grdItemDefect, true);
//base.txtBatchID_KeyPress(sender, e);
if (ViewBatchInformation(txtBatchID.Text, "RESULT") == false)
{
return;
}
string sInspSet = CommonFunction.Trim(dtBatchInfo.Rows[2][1]);
int iInspSerVer = CommonFunction.ToInt(dtBatchInfo.Rows[2][3]);
if (sInspSet != "" && iInspSerVer != 0)
{
View_Attach_Insp_Item_List_Detail(txtBatchID.Text, sInspSet, iInspSerVer);
}
//检验计划
DataTable dt2 = QCMLIST.ViewBatchInspectionPlanItemList(txtBatchID.Text);
if (dt2 != null)
{
DevGridControlHelper.BindData(gdcInspItemAll, dt2, new int[] { 1, -1, 1, -1, 1, 1 });
gdvInspItemAll.Columns["FLOW"].Group();
gdvInspItemAll.Columns["OPER"].Group();
gdvInspItemAll.ExpandAllGroups();
}
}
}
}
catch (Exception ex)
{
CommonFunction.ShowMsgBox(ex.Message);
}
}
==============
try
{
string sCoaId = gluCOATemplate.Text;
string sBacthId = txtLotID.Text;
if (e.KeyChar == (char)13)
{
if (txtLotID.Text != "" && sCoaId != "")
{
DataTable dt = new DataTable();
dt = QCMLIST.QCM_View_COA_Detail(sCoaId, sBacthId);
if (dt != null)
{
DevGridControlHelper.BindData(gdcCOAItem, dt);
DevGridControlHelper.BindData(gdcCOAItem, dt, new int[] { 1, 1, 1, 1, 1, 1 });
}
}
return;
}
}
catch (Exception ex)
{
CommonFunction.ShowMsgBox(ex.Message);
return;
}