private void txtLotNumScan_ValueChanged(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
EpiTextBox partNum = (EpiTextBox)csm.GetNativeControlReference("52c8193e-d045-4605-b11f-85d0fe8b54a8");
EpiTextBox lotNum = (EpiTextBox)csm.GetNativeControlReference("46567b2e-6bc0-4967-be35-a0ec6843838f");
EpiTextBox tbxDescription = (EpiTextBox)csm.GetNativeControlReference("7c422ab4-6df2-4e5e-ad82-196021b36a2a");
string scanLot = txtLotNumScan.Text.ToString();
//MessageBox.Show(scanLot);
if (scanLot != null)
{
//if using dynamic query...
DynamicQueryAdapter qryPartLot = new DynamicQueryAdapter(oTrans);
QueryExecutionDataSet exDS = new QueryExecutionDataSet();
QueryExecutionDataSet parameters = new QueryExecutionDataSet();
DataRow paramRow = parameters.ExecutionParameter.NewRow();
paramRow["ParameterID"] = "LotNum";
paramRow["ParameterValue"] = scanLot;
paramRow["ValueType"] = "nvarchar(30)";
paramRow["IsEmpty"] = "False";
parameters.ExecutionParameter.Rows.Add(paramRow);
qryPartLot.BOConnect();
qryPartLot.ExecuteByID("HH_ReturnPartNum", parameters);
DataSet dsPartLot = qryPartLot.QueryResults;
qryPartLot.Dispose();
foreach (DataRow dr in dsPartLot.Tables[0].Rows)
{
//MessageBox.Show(dr["PartLot_PartNum"].ToString());
partNum.Value = dr["PartLot_PartNum"].ToString();
}
partNum.Focus();
lotNum.Focus();
lotNum.Value = scanLot;
lotNum.Focus();
tbxDescription.Focus();
}
Example similar to yours, not using a button event but using textbox control events of the form.