private void officerdatagridview_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = new DataGridViewRow(); foreach (DataGridViewCell cell in officerdatagridview.SelectedCells) { row = officerdatagridview.Rows[cell.RowIndex]; } int officerid = Int32.Parse(row.Cells[0].Value.ToString()); string fullname = row.Cells[1].Value.ToString(); string[] fullnamelist = fullname.Split(' '); string surname = fullnamelist[fullnamelist.Length - 1]; string[] firstnamelist = new string[fullnamelist.Length - 1]; for (int i = 0; i < (fullnamelist.Length - 1); i++) { firstnamelist[i] += fullnamelist[i]; } string firstname = String.Join(" ", firstnamelist); string skill = row.Cells[2].Value.ToString(); string ambulanceid = row.Cells[3].Value.ToString(); this.Hide(); addeditofficerform a = new addeditofficerform(officerid, firstname, surname, skill, ambulanceid); a.Closed += (s, args) => this.Close(); a.ShowDialog(); }
private void officeraddbutton_Click(object sender, EventArgs e) { this.Hide(); addeditofficerform a = new addeditofficerform(); a.Closed += (s, args) => this.Close(); a.ShowDialog(); }