Logic Basic tutorial for beginners

Components are objects that can be created on the windows, such as text boxes, command buttons, option buttons, check boxes, calendars, scrollbars, images, etc.. There are also virtual components which can not be displayed in the windows, only the results such as the components "Rep", "Print" and "SQL."

Each type of component has a command to its creation and manipulation. The components have properties and methods. Properties are characteristics or aspects that can be assigned to a particular component or returned by him. Methods are commands that are executed by the component to perform certain tasks in relation to himself. For you to understand better, we give some examples of properties and methods:


Visible: Sets the component as visible or invisible.
Enabled: Sets the component as active or inactive.
Txt: Sets or returns the text of a component.
BackColor: Sets the background color of a component.


Select: Selects the text of a text box.
Add: Adds an item in the component.
SetFocus: Moves the focus to the component in question.
Remove: Removes the component of the window.

Every component has a name to characterize it, so two components, despite being of different types, can not have the same name. As a good programming technique, you can put an abbreviation of the component type as a prefix of their name, for example:

Text TxtTest, 3, 3
Button BtnTest, 7, 3

In the above example, the command Text will create a text box named TxtTest on line 3, column 3, and the command Button will create a button named BtnTest on line 7, column 7.

To assign a value to a property of a particular component just type the command name, the component name followed by a point, the property name, and then assign a value to the property with the sign = (equal), for example:

Text TxtTest.BackColor = Blue

In the above example, the color Blue is assigned to the property BackColor of the component TxtTest.

To execute a method of a component, the rule is pretty much the same, except that an action will be executed in relation to the component, for example:

Text TxtTest.Select

In the example above, the text contained within the text box component TxtTest will be fully selected.

In some components that have text or values​​, such as text boxes, scroll bars, radio buttons, calendars, etc.. the Logic Basic creates a variable for each component to store their values​​, and the name of this variable is the name of the component followed by the property name, for example, to get the text typed in the text box in our example just read the value of the property Txt as follows:

YourName = TxtTest.Txt

You can work with these properties in your program the same way you work with normal variables.

Variables or arrays for component names

You can create variables and vectors for component names, and this is a feature that transform the components into very versatile tools for programming.

To create variables or arrays for the name of components there is a rule: The name of the variable or array must start with the character "$", and must be of type String, for example:

Var $Customer String, $Card(3) String

That done, you can assign names to variables or arrays, for example:

$Customer = "Customer1"

$Card(0) = "Card0"
$Card(1) = "Card1"
$Card(2) = "Card2"

To create components with variables or arrays, you simply pass them in the argument Name of the components, for example:

Text $Customer, 5, 15

Picture $Card(0), "Card0.jpg"
Picture $Card(1), "Card1.jpg"
Picture $Card(2), "Card2.jpg"

Back to index      Next topic