private void GetData(String search, List <tblGame> listGame) { flpGame.Controls.Clear(); if (listGame == null) { this.listGame = gDao.GetGame(search); if (this.curUser != null) { if (this.curUser.userRole.Equals("Staff")) { this.listGame = gDao.GetGameByStaff(search); } } listGame = this.listGame; } foreach (tblGame item in listGame) { pic = new PictureBox { Width = 220, Height = 220, ImageLocation = @"..\..\..\images\" + item.gameImage, SizeMode = PictureBoxSizeMode.StretchImage, Tag = item.gameID.ToString(), Margin = new Padding(7, 10, 0, 0), }; pic.Click += new EventHandler(Pic_Click); name = new Label { Text = item.gameName, BackColor = Color.FromArgb(13, 186, 177), ForeColor = Color.White, Font = btnTrack.Font, TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Height = 40, Dock = DockStyle.Bottom, }; pic.Controls.Add(name); flpGame.Controls.Add(pic); } }