private void Prod_AddCart(object sender, AddCartEventAgrs e) { DataRow dr = dtCart.NewRow(); dr["pID"] = e.ProductID; dr["pName"] = e.ProdName; dr["pQty"] = 1; dr["pPrice"] = e.ProductPrice; dtCart.Rows.Add(dr); dtCart.AcceptChanges(); dataGridView1.DataSource = dtCart; }
private void button1_Click(object sender, EventArgs e) { //MessageBox.Show(lblName.Text); if (AddCart != null) //등록된 이벤트 핸들러가 있는지 체크 { AddCartEventAgrs args = new AddCartEventAgrs(); args.ProductID = productID; args.ProdName = ProdName; args.ProductPrice = ProductPrice; AddCart(this, args); //이벤트 발생 } }