Below is event handler to be executed when a key is pressed ('enter'). No matter where I mention the statement 'p.tag_label.Visibilty=true" in the code,it never shows the tag_label control. Please guide. I mentioned in the code where exactly the tag_label loses its visibilty.
void tag_box_KeyPress(object sender, KeyPressEventArgs e)
{
int i = (sender as TextBox).TabIndex;
if (e.KeyChar == (char)13)
{
foreach (var h in heading_wise)
{
foreach (var p in h.project_panels)
{
if (p.tag_box.TabIndex==i)
{
p.tag_text = p.tag_box.Text;
p.tag_box.Visible = false;
// p.tag_label.Visible = true;
if (!string.IsNullOrWhiteSpace(p.tag_box.Text))
{
p.tag_label.Text = p.tag_box.Text;
p.tag_label.Visible = true;
foreach (Label l in flowLayoutPanel1.Controls)
{
if (l.Text==p.tag_label.Text)
{
continue;
}
else
{
flowLayoutPanel1.Controls.Add(p.tag_label);
// Somewhere here the tag_label loses its visibilty automatically.
}
}
}
}
}
}
}
}