private void btnModify_Click(object sender, EventArgs e) { try { if (gridFiles.Rows.Count > 0) { //Find the selected id int selectedId = int.Parse(gridFiles.SelectedRows[0].Cells[0].Value.ToString()); //Find the selected row var selectedFile = list.First(x => x.Id == selectedId); //Modify the file frmFile frm = new frmFile(); frm.selectedFileToUpdate = selectedFile; frm.PopulateControls(frm.selectedFileToUpdate); this.Hide(); frm.BringToFront(); frm.ShowDialog(); this.Close(); } } catch (Exception ex) { MessageBox.Show($"Sorry an error occured.\n {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnReceiveFile_Click(object sender, EventArgs e) { frmFile file = new frmFile(); file.ShowDialog(); }