Skip to content

Reference

webweenie edited this page Sep 26, 2022 · 5 revisions

twinBASIC Language Reference

twinBASIC is a modern version of the classic BASIC programming language. While we are working hard to make twinBASIC 100% backward compatibile with existing VB6 and VBA projects, it is never going to be exactly like VB6 in every respect. For example, unlike VB6, twinBASIC supports variable initialization on the same line as the variable declaration:

Dim strMyVariable as String = "Hello World!"

Because of the necessary differences between the two languages, we have begun writing documentation for twinBASIC. Old VB6 books and manuals may still be helpful but, the documentation found here should be more accurate if there is a discrepancy. If you find that not to be the case, please post a comment in the Documentation channel with the details and we will work on getting our documentation fixed.

Thank you for supporting twinBASIC; and welcome to the family.

Controls are reusable components developers can use in their applications. Controls are often visible on the application form and provide an interaction for the user. However, some controls, the timer control for instance, are not visible to the end user. Using controls can significantly reduce the effort required to build an application in twinBASIC.

In object-oriented programming, an object is a combination of data and the code that acts upon that data. Objects protect their data by only allowing it to be accessed and changed in a defined set of ways. Command buttons, Forms, and entire applications are considered objects. Objects in the twinBASIC documentation include the various objects that don't fit into the object categories of Controls or Collections.

Collections are groups of items of the same type. Examples of collections include arrays, items in a list view, and the tabs in a tabstrip control.

A property is an attribute of an object. Objects, such as controls, can have any number of attributes which can be set by using the appropriate property. For example, the TextBox control has a Text property that allows the TextBox to be populated.

twinBASIC includes many built-in functions that simplify common tasks such as string manipulation, mathematical operations, and data type conversion. Functions return a value.

Methods are used to perform an action on an object.

Event procedures are special subroutines that objects call automatically when a pre-defined action occurs.

Statements make up the core of the twinBASIC language. They include the tools needed to control the flow of the program logic, declare objects, and handle errors.

Keywords are words that are reserved by the twinBASIC language.

trueBASIC has many built-in constants. Using constants, gives the developer a readable value that is easy to understand. Without constants, many properties would require integers to be used to represent the various states, making the code harder to write and understand later.

Operators perform an operation on one or more objects, properties, variables, constants, etc. Types of operators include arithmetic, assignment, comparison, concatenation, and logical.

Data types are used to limit the type of data that can exist in a variable, constant, or property; or be returned by a function. Limiting to only the type of data that is expected helps make applications more safe and easier to code.

Clone this wiki locally