How to add LinkLabel into Panel control
Hey guys, i want to add LinkLabels dynamically into a panel. But my code only returns me one linklabel in the panel. The rest of the linklabels doesn't appear. Can you tell me why?
Code:
foreach(FileInfo file in directory.GetFiles())
{
if( file.Extension == ".html" )
{
LinkLabel = new LinkLabel();
LinkLabel.Name = file.Name.Remove(file.Name.Length-5,5);
LinkLabel.Text = file.Name.Remove(file.Name.Length-5,5);
LinkLabel.Location = new Point(x, y);
LinkLabel.Size = new Size(220, 40);
LinkLabel.Visible = true;
Panel.Controls.Add(LinkLabel);
y += 10;
} // close if
} // close foreach
Re: How to add LinkLabel into Panel control
Your y is too small?
Perhaps change it to 25 as the default height of a label is 23.
Re: How to add LinkLabel into Panel control
Wow! u are genius :thumb: . It works! Thank you