I am working on a desktop application in c# with a barcode scanning module. The problem is that whenever I scan a barcode the application stops showing Messageboxes. Application does ot throw any exception, it just executes the code.
Application works perfectly before scanning a barcode.
I have no idea why is this happening and how do I solve it.
This is my code:
if (string.IsNullOrEmpty(BarcodeScan) && e.KeyChar.ToString() == "*")
BarcodeScan = e.KeyChar.ToString();
else if (Regex.IsMatch(BarcodeScan + e.KeyChar.ToString(), @"^[*]\d+$"))
BarcodeScan += e.KeyChar.ToString();
else if (Regex.IsMatch(BarcodeScan + e.KeyChar.ToString(), @"^[*]\d+[*]$"))
{
BarcodeScan += e.KeyChar.ToString();
ArticalID = BarcodeScan.Substring(1, BarcodeScan.Length - 2);
//Code to find article in DB
ArticalID = string.Empty;
BarcodeScan = string.Empty;
}
else
{
if (BarcodeScan.StartsWith("*"))
{
BarcodeScan = string.Empty;
}
}