August 31, 2002 - Initializing Windows Form Controls | WebReference

August 31, 2002 - Initializing Windows Form Controls

Yehuda Shiran August 31, 2002
Initializing Windows Form Controls
Tips: August 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

All controls are defined in a similar way. You first need to construct the control, and then set its Location, Size, Name, Text, and Anchor. Here is the initialization of the label control:

  label1= new Label;       
  label1.Location= new Point(10,10);
  label1.Size= new System.Drawing.Size(80,20);
  label1.Name= "label1";
  label1.Text= "This is a Label";
  label1.Anchor= AnchorStyles.Left | AnchorStyles.Top;
To learn more about JScript .NET and ASP.NET, go to Column 117, JScript .NET, Part XI: Creating Windows Forms.