// this is the software, where I detect SOF and EOT
private void RxPurchaseOrder_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
if ((e.KeyChar == AcdStart.ScannerSot) && (ScannerStarted == false))// SOH, I am using “{” as SOT u0001 creates more problems
{
ScannerMessages = “”;
e.Handled = true;
timer1.Interval = 1000;
timer1.Start();
ScannerStarted = true;
}
else
{
if (ScannerStarted == true)
{
if (e.KeyChar != AcdStart.ScannerEot)// EOT “CR”
{
ScannerMessages += (e.KeyChar);
}
else
{
ScannerStarted = false;
timer1.Stop();
timer1.Interval = 150;
timer1.Start();
}
e.Handled = true;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
when I use the scanner within Windows Form and have Datagrid in focus, every time I use scanner, the datagrid row advance to next row. I have to created dummy text box and set it into focus to prevent this issue. Does anyone can help me ? Using Visual Studio 2022
user337630 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.