Control
Previous Top Next

Control keyword allows you to access a control using a string instead of its name.
The Control keyword can be used with objects as well.
Syntax: Control (Control Name [,Type])

As of version 6.00, the compiler may ask you to specify the control's or object's type.

The following properties does not require you to specify the type:
Text, Left, Top, Width, Height, Visible, Enabled, Focus, BringToFront, Color, FontColor, FontSize, Refresh, Dispose, Name, Image, Checked, IgnoreKey, SelectionLength, SelectionStart, ScrollToCaret, Multiline and LoadPicture.

Type can be any type from the following list or any object type from one of the referenced libraries:
ArrayList, Button, CheckBox, ComboBox, Calendar, Form, Image, ImageButton, ImageList, Label, ListBox, Menu, NumUpDown, OpenDialog, Panel, RadioBtn, SaveDialog, TextBox, Table and Timer.

Example:
Control ("Button1").Color = cGreen
Control("Form1",Form).Show

Example:
For i = 1 To 10
            Control ("Button" & i ).Color = cBlue
Next