private void btnSoonInSales_Click(object sender, EventArgs e) { SearchPanel.Location = new Point(26, 11); btnBack.Visible = false; _obj = this; if (InfoPanel.Controls.Count > 0) { InfoPanel.Controls.RemoveAt(0); } BookControl bookControl = new BookControl(); InfoPanel.Controls.Add(bookControl); bookControl.Dock = DockStyle.Fill; bookControl.BringToFront(); PrintBooks(bookControl, "Скоро в продаже"); }
//-------------------------------- Книги private void PrintBooks(BookControl bookControl, string str) { OleDbCommand command = new OleDbCommand("SELECT * FROM Books", myConnection); myConnection.Open(); OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { if (str == reader[2].ToString()) { ElBook Item = new ElBook(); byte[] Photo = (byte[])(reader[12]); MemoryStream memoryStream = new MemoryStream(Photo); Item.gunaPictureBox1.Image = Image.FromStream(memoryStream); Item.NameBook.Text = reader[1].ToString(); bookControl.flowLayoutPanel1.Controls.Add(Item); } } reader.Close(); myConnection.Close(); }