| Visual Basic Syntax
In version 3.xx, Superbase introduced support for the VB
style of programming. Our example would look like this:
SUB main()
OPEN FILE SHARE,0"PEOPLE"
Superbase.Form.Open("CONTACT")
SELECT KEY "John Smith"
CALL ring_the_bell( 5 )
END SUB
SUB ring_the_bell( num_times% )
FOR I% = 1 to num_times%
Superbase.Bell
NEXT I%
END SUB
Although this is similar to the QuickBasic syntax, the VB
syntax is more powerful because is self-documents that "object
model" that the program operations under. For example
in this code, you can determine that the Open method of the
Form object is owned by the parent of Superbase. And you can
also see that the Bell method of the Superbase object is the
same as beeping the speaker.
Although the VB syntax is the current hot programming language,
many people find it more difficult to read then the other
forms (like QuickBasic) of BASIC syntax.
Exercise
Write a small program to open a file, then open a form, and
then select the first record, and then print it to the printer.
Hint (turn on the Macro recorder and record yourself doing
these operations manually, and then turn off the recorder
and see what the code looks like in the program editor. |