private void CreateActiveCartsbuttons() { CartBL cartBL = new CartBL(new Credential { UserName = InterplayStorage.SelectedUser.UserName, Password = InterplayStorage.SelectedUser.Password }); List <Cart> carts = cartBL.GetActiveCartsByUser(); foreach (Cart cart in carts) { InterPlayPOSCartButton button = new InterPlayPOSCartButton(); button.Cart = cart; button.Text = cart.cartId; button.Click += Cart_Button_Click; this.flowLayoutPanelCarts.Controls.Add(button); } }