private void addRecipeDatasForm_Load(object sender, EventArgs e) { DataSet drugDataSet = new DataSet(); hbys_winApp.hisLib drugHisLib = new hisLib(); drugDataSet = drugHisLib.DrugList(); comboDrug.Items.Clear(); for (int i = 0; i < drugDataSet.Tables[0].Rows.Count; i++) { titleBoxItem drugBoxItem = new titleBoxItem(); drugBoxItem.Txt = drugDataSet.Tables[0].Rows[i]["DrugName"].ToString(); drugBoxItem.Val = drugDataSet.Tables[0].Rows[i]["DrugNo"].ToString(); comboDrug.Items.Add(drugBoxItem); } if (comboDrug.Items.Count > 0) { comboDrug.SelectedItem = 0; } }
private void button1_Click(object sender, EventArgs e) { hbys_winApp.hisLib hospital_drug_name = new hisLib(); DGVdrug.DataSource = hospital_drug_name.DrugList().Tables[0]; }