If you would like to get data from text file and display it in labels, you have to read them from array of lines.
I've changed your code a bit...
string [] lines = File.ReadAllLines(@"C:\NoosApp\Details\floor.txt");
int numOfLines = lines.Length;
for (int i = 0; i < numOfLines; i++)
{
System.Windows.Forms.Label lbl = new System.Windows.Forms.Label();
lbl.Top = i * 58;
lbl.Left = 1400;
lbl.Width = 350;
lbl.Height = 50;
lbl.AutoSize = false;
lbl.TextAlign = ContentAlignment.MiddleRight;
lbl.Name = "Label" + i.ToString();
lbl.Text = lines[i];
lbl.ForeColor = Color.Black;
lbl.Font = new Font("Fb reforma", 36);
lbl.BackColor = Color.White;
this.Controls.Add(lbl);
}
Note #1: You don't need to read text file twice to get the numer of lines and lines itself!
Note #2: You don't need [
B
] variable, because you can use [
i
] inside a
for
loop.
Please, read carefully solution #1 by
BillWoodruff[
^], because it contains few very important suggestions.