private void AddItem(string BarCode, decimal decQuantity, string BaseUnitCode, string ProductCode) { try { if (mclsInvLog.BranchDetails.BranchCode != mclsBranchDetails.BranchCode) { mclsInvLog.BranchDetails = mclsBranchDetails; } mclsInvLog.AddItem(BarCode, decQuantity, BaseUnitCode, ProductCode); } catch (Exception ex) { if (ex.Message.Contains("being used by another process")) { MessageBox.Show("An error has occured while reading inventory file. To avoid damage in the file, system will not exit. Please re-open the system again.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); } } }