private void txtSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { BL.Cls_Patient p = new BL.Cls_Patient(); dt = p.SelectpatientInNum(Convert.ToInt32(txtSearch.Text)); dataGridView1.DataSource = dt; } catch (Exception) { MessageBox.Show("ادخل رقم المريض للبحث او قم بالضغط على زر البحث "); } } }
public void PrintFile() { try { BL.Cls_Patient pit = new BL.Cls_Patient(); int id; if (txtIdPatient.Text == "") { XtraMessageBox.Show("افرغ الحقول ثم قم بإضافة بيانات المريض"); id = Convert.ToInt32(txtIdPatient.Text); } else { id = Convert.ToInt32(txtIdPatient.Text); } this.Cursor = Cursors.WaitCursor; // تحديد نوع السند RP.ViweReports frmRep = new RP.ViweReports(); RP.File_Patient reprot = new RP.File_Patient(); dt.Clear(); dt = p.SelectpatientInNum(id); reprot.SetDataSource(dt); reprot.SetParameterValue(0, id); //frmRep.crystalReportViewer1.Refresh(); frmRep.crystalReportViewer1.ReportSource = reprot; frmRep.Show(); this.Cursor = Cursors.Default; } catch (Exception) { } }