void Details(Documents item) { try { UnitOfWork unitOfWork = new UnitOfWork(new DTSDb()); var staticSettings = new StaticSettings(); item = unitOfWork.DocumentsRepo.Find(x => x.Id == item.Id); this.dtDate.EditValue = item.Date; this.txtCommType.EditValue = item.CommunicationType; this.txtDocType.EditValue = item.DocumentType; this.txtSignatory.Text = item.Employees?.EmployeeName; this.txtSubject.EditValue = item.Subject; this.lblSignatory.Text = item.Employees?.EmployeeName; this.lblType.Text = item.DocumentType; this.pctScannedImage.Image = ScannerHelper.LoadImage(item.Id, "Documents"); tabActionTaken.Controls.Clear(); tabActionTaken.Controls.Add(new UCDocumentActions(item.Id, item.ControlNo, "", "Documents") { Dock = DockStyle.Fill }); tabLetter.Controls.Clear(); tabLetter.Controls.Add(new UcLetters(item.Id, item.ControlNo, "Documents", $"[{staticSettings.Offices.OffcAcr}]Document Tracking System ({User.GetUserName()}) {item.ControlNo}") { Dock = DockStyle.Fill }); tabFiles.Controls.Clear(); tabFiles.Controls.Add(new UCFiles(item.Id) { Dock = DockStyle.Fill }); var row = DocumentGridView.LocateByValue("Id", item.Id); this.DocumentGridView.FocusedRowHandle = row; this.DocumentGridView.MakeRowVisible(row); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }