In my flow layout panel it load pic and name in user control.
I try this, which is working fine
foreach (DataRow row in dt.Rows)
{
byte[] data = (byte[])row["Image"];
pic = new PictureBox();
pic.Width = 150;
pic.Height = 150;
pic.BackgroundImageLayout = ImageLayout.Stretch;
pic.BorderStyle = BorderStyle.FixedSingle;
string type = row.Table.Columns.Contains("liquidPriceId") ? "liquidPrice" : "itemMaster";
string tag = row.Table.Columns.Contains("liquidPriceId") ? row["liquidPriceId"].ToString() : row["itemMasterId"].ToString();
MemoryStream ms = new MemoryStream(data);
pic.BackgroundImage = new Bitmap(ms);
Label name = new Label();
name.Text = row["Name"].ToString();
name.BackColor = Color.FromArgb(45, 66, 91);
pic.Controls.Add(name);
flp.Controls.Add(pic);
}
THEN in my search text change I try this, my problem is I don't know how to get the name for filtering
foreach (Control c in flowLayoutPanel3.Controls)
how to get inside c of my pic and name values ?
private void txtSearchBox_TextChanged(object sender, EventArgs e)
{
string searchValue = txtSearchBox.Text;
try
{
if (txtSearchBox.Text.Length > 0)
{
string compareTo = String.Concat("*", txtSearchBox.Text.ToLower(), "*");
foreach (Control c in flowLayoutPanel3.Controls)
{
c.Visible =(c.Name.ToLower() == compareTo); // c.Name is empty how can i get name ?
}
}
else
{
foreach (Control c in flowLayoutPanel3.Controls)
{
c.Visible = true;
}
}
}
}