Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple labels

Tags:

c#

label

I want to use multiple labels in my form. I am using the following code:

 Label[] lblLeftUp = new Label[12];
 for (int i = 0; i < 12; i++)
 {
    lblLeftUp[i] = new Label();
    lblLeftUp[i].Location = new Point((100 + (20 * i)), 100);
    lblLeftUp[i].Text = Convert.ToString(i + 1);
    this.Controls.Add(lblLeftUp[i]);
 }

however, I can see only one label. any idea to fix that?

like image 253
MKS Avatar asked Nov 23 '25 14:11

MKS


1 Answers

The labels are blocking eachother. So try this:

lblLeftUp[i].AutoSize = true;
like image 71
OMGKurtNilsen Avatar answered Nov 25 '25 04:11

OMGKurtNilsen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!