private void SelectVariation(int iRow) { try { mstBarCode = string.IsNullOrEmpty(dgItems[iRow, 3].ToString()) ? dgItems[iRow, 4].ToString() : dgItems[iRow, 3].ToString(); ProductModel.Clear(); ProductModel.PackageID = Int64.Parse(dgItems[iRow, 0].ToString()); ProductModel.ProductID = Int64.Parse(dgItems[iRow, 1].ToString()); ProductModel.MatrixID = Int64.Parse(dgItems[iRow, 2].ToString()); ProductModel.BarCode = mstBarCode; } catch (Exception ex) { MessageBox.Show("No item has been selected. Please select at least 1 item.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error); Event clsEvent = new Event(); clsEvent.AddEventLn("Item select error. TRACE: " + ex.Message.Replace(Environment.NewLine, ""), true); } }