//For Print In textbox1 and in textbox2 private void dataGridView1_(object sender, DataGridViewCellEventArgs e) { c = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["الكود"].Value.ToString()); name = dataGridView1.Rows[e.RowIndex].Cells["الاسم العربى"].Value.ToString(); جدولة_العيادات f = new جدولة_العيادات(c, name); f.Focus(); this.DialogResult = DialogResult.OK; f.ShowListBox(); f.Refresh(); f.Focus(); }
//For button جدوله عياده private void button32_Click(object sender, EventArgs e) { جدولة_العيادات f = new جدولة_العيادات(); if (f.ShowDialog() == DialogResult.OK) { if (listBox1.Items.Contains(names)) { MessageBox.Show("انت قمت بادخال هذه العياده"); } else { listBox1.Items.Add(names); code = Convert.ToInt32(f.textBox1.Text); // con = new SqlConnection(@"server=SANDRA-PC\SQLEXPRESS;database=project_db; Integrated Security=true;"); // con.Open(); // cmd = new SqlCommand("select arabic_des from clinic_service where ccode=" + code + "", con); con1.OpenConection(); dr = con1.DataReader("select SLS_Aname from tb_Second_Level_Service where [SLS_Service_Category]='Outer_Clinic' and [SLS_Status]=1"); try { //dr = cmd.ExecuteReader(); service = ""; while (dr.Read()) { service = dr[0].ToString(); } if (String.IsNullOrEmpty(service)) { service = "لا توجد خدمه في هذه العياده"; listBox3.Items.Add(service); } else { listBox3.Items.Add(service); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con1.CloseConnection(); } } } }