private void ChangeBarcodeTransDGVCellValues() { try { BarcodeTransDGV.EditMode = DataGridViewEditMode.EditProgrammatically; foreach (DataGridViewRow dgvr in BarcodeTransDGV.Rows) { DataTable dt = btdao.GetAllBarcodeTransactions(dgvr.Cells[0].Value.ToString(), string.Empty, string.Empty, string.Empty, string.Empty, true); if (!dt.Rows[0]["Module_Serial_Number"].ToString().Equals(dgvr.Cells[1].Value.ToString())) { BarcodeTransDGV.CurrentCell = dgvr.Cells[1]; BarcodeTransDGV.BeginEdit(true); dgvr.Cells[1].Value = dt.Rows[0]["Module_Serial_Number"].ToString(); BarcodeTransDGV.CommitEdit(DataGridViewDataErrorContexts.Commit); BarcodeTransDGV.EndEdit(); } if (!dt.Rows[0]["BarcodeReaderSerialNumber"].ToString().Equals(dgvr.Cells[2].Value.ToString())) { BarcodeTransDGV.CurrentCell = dgvr.Cells[2]; BarcodeTransDGV.BeginEdit(true); dgvr.Cells[2].Value = dt.Rows[0]["BarcodeReaderSerialNumber"].ToString(); BarcodeTransDGV.CommitEdit(DataGridViewDataErrorContexts.Commit); BarcodeTransDGV.EndEdit(); BarcodeTransDGV.CurrentCell = dgvr.Cells[3]; BarcodeTransDGV.BeginEdit(true); dgvr.Cells[3].Value = dt.Rows[0]["LaminatorNumber"].ToString(); BarcodeTransDGV.CommitEdit(DataGridViewDataErrorContexts.Commit); BarcodeTransDGV.EndEdit(); } if ((!string.IsNullOrEmpty(dt.Rows[0]["ErrorID"].ToString())) && (Int32.Parse(dt.Rows[0]["ErrorID"].ToString()) > 0) && (!string.IsNullOrEmpty(dt.Rows[0]["IsErrorResolved"].ToString()))) { BarcodeTransDGV.CurrentCell = dgvr.Cells[7]; BarcodeTransDGV.BeginEdit(true); dgvr.Cells[7].Value = dt.Rows[0]["IsErrorResolved"].ToString(); BarcodeTransDGV.CommitEdit(DataGridViewDataErrorContexts.Commit); BarcodeTransDGV.EndEdit(); } //BarcodeTransDGV.CommitEdit(DataGridViewDataErrorContexts.Commit); //BarcodeTransDGV.EndEdit(DataGridViewDataErrorContexts.Commit); BarcodeTransDGV.Refresh(); } } catch (InvalidOperationException ioe) { MessageBox.Show("Invalid operation exception occured at ChangeBarcodeTransDGVCellValues(): " + ioe.Message); } catch (Exception ex) { MessageBox.Show("exception occured at ChangeBarcodeTransDGVCellValues(): " + ex.Message); } //DataTable CurrentRecordsInBarcodeTransDGV = (DataTable)BarcodeTransDGV.DataSource; }
private void PerformThreadSafeBarcodeTransDGVCellValueChanges(object sender, ElapsedEventArgs eea) { BarcodeTransDGV.Invoke(this.CheckBarcodeTransDGVCellValsDel); }
private void PerformThreadSafeDGVUpdations(object sender, ElapsedEventArgs eea) { BarcodeTransDGV.Invoke(this.UpdateDataGridViewDelegate); }