All of the controls that you can drag onto the designer are objects that can be referenced and declared in code.
TextBox txt = new TextBox; // Declares a textbox control
txt.ForeColor = System.Drawing.Color.Red; // Assigns the text color to red
this.Controls.Add(txt); // Adds the textbox control created above to the page/form's control heirarchy.
Subscribe to:
Post Comments
(Atom)
No comments:
Post a Comment