-
How to place controls?
OK, you place everything with the designer. Now I just want to place a create a TextBox on the Form. How do I do this? I just do:
Code:
TextBox t = new TextBox();
t.Location = new Point(10, 10);
this.controls.Add(t);
But it doesn't appear on the Form. What more do I need?
-
t.Size = new Size(300, 20);
-
"controls" has a capital C.
Where exactly are you calling this? Works fine for me, you probably put it somewhere which isn't called.
-
Lol. I typed TextBox. I wanted to type PictureBox. In which case I wasn't setting the BackColor so it didn't appear because it probably gave a default color which was the same with the Form. Stupid mistake.