private void patientJournalBtn_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { string personid = dataGridView1.CurrentRow.Cells[0].Value.ToString(); Patient patientToOpen = db.LoadPatient(personid); Employee user = data.MyUser; Form patjourn = new PatientJournalForm(patientToOpen, user); patjourn.Show(); } }
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { foreach (DataGridViewRow row in this.dataGridView1.SelectedRows) { DataRowView dataRowView = this.dataGridView1.Rows[row.Index].DataBoundItem as DataRowView; var dataRow = dataRowView.Row as DataRow; string personNumber = dataRow["person_id_nr"].ToString(); //var test2 = test[0] as Patient; if (dataRowView != null) { DatabaseHandler dbHandler = new DatabaseHandler(); HospitalDataSetTableAdapters.patientTableAdapter patientTableAdapter = new HospitalDataSetTableAdapters.patientTableAdapter(); Form journal = new PatientJournalForm(dbHandler.LoadPatient(personNumber), data.MyUser); journal.Show(); } } //Patient test = ((DataGridView)sender).DataSource as Patient; //Form journal = new PatientJournalForm(); //journal.Show(); }