private void button3_Click(object sender, EventArgs e) { if (textBox2.Text.Trim() != "" && textBox3.Text.Trim() != "") { Drug orderDrug = null; Entp orderEntp = null; int ordercount = int.Parse(textBox3.Text); foreach (var item in DataManager.drugs) { if (textBox2.Text == item.MedName) { orderDrug = item; } } foreach (var item in DataManager_comp.Comps) { if (orderDrug.MedComp == item.entpName) { orderEntp = item; } } DrugOrderForm.orders.Add(new DrugOrder(orderDrug, orderEntp, ordercount)); /*foreach (var item in orderList) * { * MessageBox.Show(item.Drug.MedName + " " + item.Entp.entpName + " " + item.Count.ToString()); * }*/ MessageBox.Show(textBox2.Text + "수량" + textBox3.Text + "개 가 주문서에 추가 되었습니다."); } else if (textBox3.Text.Trim() == "") { MessageBox.Show("수량을 입력해주세요"); } else { MessageBox.Show("약품명을 입력해주세요"); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { Drug drug1 = dataGridView1.CurrentRow.DataBoundItem as Drug; textBox2.Text = drug1.MedName; }