private void cellclick(object sender, DataGridViewCellEventArgs e) { try { reason = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); الغاء_زيارة_مريض_خارجى f = new الغاء_زيارة_مريض_خارجى(); f.Focus(); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void dataGridView1_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) { try { Code = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); } catch (Exception ex) { MessageBox.Show("يجب اختيار مريض"); } /* * * * create procedure clinic_patient_visit_select(@Code int) * as * begin * select Type , num_of_visit from patient_visit where P_id = @code and num_of_visit =(select MAX(num_Of_visit) from Patient_visit where p_id = @code) * end * * */ con1.OpenConection(); types = new SqlDbType[] { SqlDbType.Int }; name_input = new string[] { "@code" }; values = new string[] { Code.ToString() }; SqlDataReader dr = con1.ShowDataInGridViewUsingStoredProcDR("clinic_entranceoffice_visit_select", name_input, values, types); while (dr.Read()) { if (dr[0].ToString() == "خارجي") { max_visit = int.Parse(dr[1].ToString()); الغاء_زيارة_مريض_خارجى f = new الغاء_زيارة_مريض_خارجى(); this.Close(); f.Show(); } else { MessageBox.Show("يجب اختيار مريض خارجى"); } } dr.Close(); con1.CloseConnection(); }