private void newItemButton_Click(object sender, EventArgs e) { NewItemForm form = new NewItemForm(new OrderItem()); if (form.ShowDialog() == DialogResult.OK) { currentOrder.AddItem(form.item); } this.itemBindingSource.ResetBindings(false); }
private void EditItem() { OrderItem orderItem = itemBindingSource.Current as OrderItem; if (orderItem == null) { MessageBox.Show("请选择一个商品进行修改"); return; } NewItemForm form = new NewItemForm(orderItem); if (form.ShowDialog() == DialogResult.OK) { itemBindingSource.ResetBindings(false); } }