doc • naming

Naming Conventions

The naming conventions are not required by the compiler. But programs which use the following naming conventions are easier to read by other programmers who want to understand the program.

Variable names

All private variable names of a class start with $

The first letter is lower case and should depend on the type of the variable:


a Array
b Boolean
c Collection
f Float
h Object (Handle)
i Integer, Long, Short, Byte.
n An integer storing a number of objects.
s String


Private $iLast As Integer
Private $sLast As String
Private $hEditor As Object
Private $sOldVal As String
Private $bFreeze As Boolean

Public Sub Form_Resize()

  Dim iWidth As Integer

Form element names

When placing a new form element. Gambas gives it a name like "Label1" "Label2" ...

Before you assign a method to the new element, you rename it to "btnStart" or "lstAddressSelect". The first two or three lower case letters should be given according to this definition:


btn Button, use btnOK btnCancel for OK, Cancel
chk CheckBox
cvw ColumnView
cmb ComboBox
dwg DrawingArea
dlg FontChooser
edt GambasEditor
frm Frame
grd GridView
spl HSplit
iv IconView
lbl Label
lbl TextLabel
lst ListBox
lvw ListView
pan Panel
img PictureBox
opt RadioButton
svw ScrollView
spb SpinBox
tab TabStrip
tim Timer
txa TextArea
txt TextBox
txv textview
tbt ToolButton
trv TreeView
spl VSplit

A project which uses this style is the Gambas IDE (under /app/src/gambas3 in the source tree). It contains lots of more prefixes for various controls.