public FormTable() { InitializeComponent(); UserControl_Table usercontrol_table = new UserControl_Table(); usercontrol_table.LoadData_Table(FlowLayoutPanel_Table); }
private void Btn_Delete_Click(object sender, EventArgs e) { bool found = false; foreach (UserControl_Add control in FormMain._FormAdd.FlowLayoutPanel_ListAdd.Controls) { if (control == this) { foreach (UserControl_Item item in FormMain.List_Item) { if (item.UserControlAdd == control) { item.gunaGradientButton_tick.Visible = false; item.gunaLinePanel_tick.Visible = false; break; } } control.SetQuantity(0); FormAdd.List_Add.Remove(control); control.Dispose(); found = true; break; } } if (found == false) { foreach (UserControl_Add control in FormMain._FormOrder.FlowLayoutPanel_Bill.Controls) { if (control == this) { control.SetQuantity(0); UserControl_Order usercontrol_order = new UserControl_Order(); usercontrol_order.Remove_UserControlAdd(control); control.Dispose(); found = true; break; } } } if (found == false) { foreach (UserControl_Add control in FormMain._FormTable.FlowLayoutPanel_Bill.Controls) { if (control == this) { control.SetQuantity(0); UserControl_Table usercontrol_table = new UserControl_Table(); usercontrol_table.Remove_UserControlAdd(control); control.Dispose(); break; } } } }
// chuyen du lieu tu DAO public void LoadData_Table(FlowLayoutPanel flowlayoutpanel) { LinkedList <int> listDAO = TableDAO.Instance.GetIDTable(); for (int i = 1; i <= listDAO.Count; i++) { UserControl_Table a = new UserControl_Table(); a.Label_ID_Table.Text = i.ToString(); flowlayoutpanel.Controls.Add(a); } }