Domanda

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;
}
È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top