// member contructor public UpdateDetaiItem(DetailGridViewDataSource arg) { this.InitializeComponent(); /** * start to load list product types and coresponding prodcuts from database into view component(ComboBox Edit) * */ // load product types from database }
private void sửaToolStripMenuItem_Click(object sender, EventArgs e) { if (this.gridViewDanhSachSanPham.SelectedRowsCount == 0 || this.gridViewDanhSachSanPham.SelectedRowsCount > 1) { return; } // get value from selected row DetailGridViewDataSource item = (DetailGridViewDataSource)this.gridViewDanhSachSanPham.GetRow(this.gridViewDanhSachSanPham.FocusedRowHandle); // start to show the update form UpdateDetaiItem updateDetailItemForm = new UpdateDetaiItem(item); updateDetailItemForm.sendBackDelegate = new UpdateDetaiItem.onDataSendBack(this.updateDetailItemDelegate); // instance a delegate for form updateDetailItemForm.ShowDialog(); }
// delegate function private void updateDetailItemDelegate(DetailGridViewDataSource arg) { }