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;
}
Was it helpful?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top