Controls
The Controls region is used to instantiate the child control and component objects of the form. This typically includes buttons, textboxes, labels, and combo boxes. These classes are defined in the System.Windows.Forms .NET namespace, and must be instantiated after that assembly has been loaded.
This region is denoted with the #region Controls tag and must occur between the Appearance and Forms regions in a ScriptoForm script.
Examples
Section titled “Examples”#region Controls$FormMain = New-Object -TypeName System.Windows.Forms.Form$GroupBoxMain = New-Object -TypeName System.Windows.Forms.GroupBox$LabelServerName = New-Object -TypeName System.Windows.Forms.Label$TextBoxServerName = New-Object -TypeName System.Windows.Forms.TextBox$ButtonRun = New-Object -TypeName System.Windows.Forms.Button$ButtonClose = New-Object -TypeName System.Windows.Forms.Button$StatusStripMain = New-Object -TypeName System.Windows.Forms.StatusStrip$ToolStripStatusLabelMain = New-Object -TypeName System.Windows.Forms.ToolStripStatusLabel$ErrorProviderMain = New-Object -TypeName System.Windows.Forms.ErrorProvider#endregionAlthough called Controls, this region can contain both components and controls. A control it is more typically found in this region due to its graphical nature, and hence that is the name that is used for this regions. By convention, controls are typically defined at the top of the region (usually in the order they will appear on the Form) and components are defined at the bottom of the region.
The Controls region in a newly provisioned ScriptoForm contains the following comment blocks:
<#Instantiate control objects here...#>
<#Instantiate component objects here...#>Remove these comment blocks and replace them with the actual control and component instantiations. They are currently acting only as reminders.
#region Settings<#Instantiate control objects here...#>$LabelServerName = New-Object -TypeName System.Windows.Forms.Label$TextBoxServerName = New-Object -TypeName System.Windows.Forms.TextBox
<#Instantiate component objects here...#>$ErrorProviderMain = New-Object -TypeName System.Windows.Forms.ErrorProvider#endregion