Question

I need some help with C# at generating things.

I tried and it didn't work. Heres my code:

public static void MakeNewLabel()
{
   Label myLabel = new Label();
   myLabel.Name = "myLabelName";
   myLabel.Text = "";
   myLabel.Location = new Point(13, min_char + 3);
   myLabel.Visible = true;
}
Était-ce utile?

La solution

public static Label MakeNewLabel()
{
   Label myLabel = new Label();
   myLabel.Name = "myLabelName";
   myLabel.Text = "";
   myLabel.Location = new Point(13, min_char + 3);
   myLabel.Visible = true;
   return myLabel;
}


this.Controls.Add(MakeNewLabel());

Try the above

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top