private void button7_Click(object sender, EventArgs e) { if (textBox4.Text != "") { opd opd = new opd(); dbconnect db = new dbconnect(); opd.duplicatePatientSlip(textBox4.Text, db); if (opd.dr.Read()) { //MessageBox.Show(opd.dr[9].ToString()); opd.patientAge(db.dr[0].ToString()); medicine_id = opd.dr[9].ToString().Split(','); medicines = opd.dr[10].ToString().Split(','); dosage = opd.dr[11].ToString().Split(','); quantity = opd.dr[12].ToString().Split(','); id = db.dr[0].ToString(); symptoms = db.dr[1].ToString(); remarks = db.dr[2].ToString(); doctor = db.dr[3].ToString(); date = db.dr[4].ToString().Substring(6, 2) + "-" + db.dr[4].ToString().Substring(4, 2) + "-" + db.dr[4].ToString().Substring(0, 4); name = db.dr[5].ToString(); gender = db.dr[7].ToString(); age = opd.age.ToString(); for (int i = 0; i < medicine_id.Length; i++) { if (medicine_id[i] == "LP") { LP = true; break; } } if (MessageBox.Show("Are you sure you want to Print Duplicate Patient Slip??", "Duplicat Patient Slip??", MessageBoxButtons.YesNo) == DialogResult.Yes) { printDocument1.Print(); // printPreviewDialog1.ShowDialog(); } } else { MessageBox.Show("Invalid OPD!!"); } db.dbclose(); } }