I have a panel in winforms app in which I want to display some data in vertical alignment. I will get that data from XML document. I'll loop through XML like this:
for (int i = 0; i < node.ChildNodes.Count; i++)
{
lbl = new Label();
lbl.Text = node.ChildNodes[i].Name + " = " + node.ChildNodes[i].InnerText;
panel1.Controls.Add(lbl);
}
At the end I can see only the first record displayed at the top left corner of the panel, but looping through the panel1.controls
, I can see the count is 79, I just need to position them correctly.
How can I achieve that?
You could use a FlowLayoutPanel instead and set its FlowDirection property to TopDown
.