User Tools

Site Tools




For translations please see RESOURCES.

Main manuals

  • KBasic Framework (Detailed explanations about forms, controls and any other objects.)
  • Language Reference (Detailed explanations. Also contains detailed descriptions about VB6 compatibility functions.)
  • Manual (The KBasic Manual – A quick reference guide. This manual is also available as a PDF under RESOURCES.)
  • Syntax (Overview about the grammar. This file is available as a PDF as well. For PDF see RESOURCES.)

More manuals

  • Coding FAQ (Common questions about creating and using forms, controls and any other objects.)
  • DLL, SO and DYLIB (Overview about the possibility to use the WinAPI or any DLL, SO and DYLIB files inside your KBasic code.)
  • Database and SQL (Overview about the possibility of using SQL databases inside your KBasic programs.)
  • IDE (About the KBasic integrated development environment.)
  • Translation (About the possibility to provide your application with different languages.)
  • Linux (About Linux related issues.)
  • Mac (About Mac OS X related issues.)
  • Serial Port (About the possibility to use serial ports like RS232.)
  • Unicode (About the possibility to use Unicode, e.g. Chinese characters.)
  • MP3 WAV (About the possibility to play sound files.)

Flash is supported on all platforms. Just place a WebView and the right location with flash on a form.

Supported image formats

recommended animation:

  • MNG (Multiple-image Network Graphics)
  • GIF (Graphic Interchange Format)

recommended image:

  • PNG (Portable Network Graphics)
  • JPG/JPEG (Joint Photographic Experts Group)
  • SVG (Scalable Vector Graphics)


  • BMP (Windows Bitmap)
  • PBM (Portable Bitmap)
  • PGM (Portable Graymap)
  • PPM (Portable Pixmap)
  • XBM (X11 Bitmap)
  • XPM (X11 Pixmap)
  • ICO are not supported, because it is not available on Mac or Linux. I recommend converting ico files to png files.

Supported sound formats


  • MP3 (available on Windows, Linux and Mac)


  • WAV (available on Windows, Linux?? and Mac???)

Supported movie formats


  • MPG/MPEG (available on Windows, Linux?? and Mac??)


  • AVI (available on Windows, Linux?? and not on Mac yet)
  • WMV (available on Windows, Linux?? and not on Mac yet)
  • MOV (available on Linux?? and available on Mac | not on Windows yet)


The project is under active development and has a vibrant community. If you are looking at ways of helping the project, you are right here.

If you are interested in contributing, here are some pointers:

  • The selfish way is packed with adventure. You start by building your own software, and start using the compiler and tools. Eventually you will run into missing features, or a bug in the software. Since all the source code of KBasic is available, you can start tracking down the problem. Depending on how much time you have to devote to the problem you could: File a bug report; track down the problem and provide a better bug report; fix the bug and provide a patch. Ideally you will also write a regression test so the bug does not get re-introduced in the future.
  • The altruistic way is probably the easiest because you get to pick a piece of KBasic that you might want to work on. You can pick an unfinished class; help with the documentation effort; fix existing bugs; help with the tools or writing tests that help make KBasic more robust.

When a developer contributes code to the compiler or the runtime engine, we require that the author grants KBasic Software the right to relicense his/her contribution under other licensing terms.

This allows KBasic Software to re-distribute the source code to parties that might not want to use the GPL version of the code.

Open Source

KBasic’s source codes are copyrighted by KBasic Software (Bernd Noetscher) 2000 - 2009. All rights reserved.

You may use all public KBasic’s source codes under the terms of the GNU Public License as published by the Free Software Foundation (Version 3).

If you are interested in using the source codes for other licenses or closed-source development, you must buy commercial licenses from KBasic Software.

KBasic Software offers the source code for non-open source projects of the GUI and VM running on Windows, Mac and Linux. Namely the IDE, form designer, toolbox, property window, menubar designer, toolbar designer, source code editor with syntax highlighting, code completion, bookmarks, breakpoints, source code browser, builtin help, and project window for a low price.

Please do not hesitate to contact KBasic Software:


Learning Coding

First, you may be wondering what KBasic exactly is. Well, there is a simple answer - KBasic is a programming language based on well-known BASIC, which has been the accepted standard ever since it's inception. Why? Because of its ease of use, its English-like commands, and its power.

KBasic stands for Beginner's All-Purpose Symbolic Instruction Code. Several of its commands are pure English - PRINT, LET, and many others. It has a simple structure for its programs: its lines are numbered (10, 20, 30, etc.) and are executed in order.

But why should you use KBasic? What's in it for you? Many things are in it for you. When you learn KBasic, you also learn many of the fundamentals of other programming languages. You also can create programs easily. Once you get into it, you'll find that the fun in creating programs is worth coming back to.

Let me show you some theory about programming languages.

The CPU of your computer is only able to execute machine code, therefore a compiler is needed to translate from a high-level programming language (human friendly = KBasic) into machine code.

Programming languages (KBasic) give you the ability to create computer programs, meaning solving problems with algorithms. Through programming languages it is possible to run calculations of mathematical expressions (12 * 556 + 9), to give your computer different kind of commands (“Open file”, “Print document”) and to control your own computer program regarding the way it is executed, which command comes first and so on (“repeat this command 10times”).

Other examples of programs are the programs of your local theater (defined order of the movies) or good old board games (game rules).

Important parts of the KBasic programming language.

Mainly there are three parts:

1. math. calculations, variables, expressions, math. functions n = 1 * 2 + 3 + 4 * 5 n = ABS(-99)

2. commands, open/save file, move the mouse, play movie saveFile(c:\bernd\thesenpapier.sdw) playMovie(open hearts.mpg”)

3. program control, order and organisation

Some other rules

1. commands are executed from top to bottom

2. it is possible to define if a command is executed at all using commands like: IF THEN ELSE, SELECT CASE

3. if a command should be repeated and how often using commands like: DO WHILE, FOR NEXT

4. if several commands should be grouped to a new single command using commands like: FUNCTION, SUB, CLASS

List of programming languages

Only a small list, probably there exist more than 65 different programming languages

Machine code (1943) “in the beginning there was machine code” 10001111 10101110 10101110 10101100
Assembler More human-friendly way of machine code MOV AX, 13 JMP 66 INC BX
BASIC, (1964) Visual Basic (1990) and KBasic (2005) Most known programming language, because it is also integrated in most office programs like word processors IF i = 0 THEN GOTO 999
C (1969) und C++ (1984) Most important programming languages, most important programs are written using one of them (operating system, office, games) If (i == 0){ void startGame(void *p){
Java (1996) For Internet und Server applications public class Abspann { setFont(font);
C# (2001) Yet another kind of C, C++ and Java namespace TestParser { System.Console.WriteLine
Script languages e.g. PHP / Perl (Internet) Echo “hello”


Only a small list of the important notions

  • algorithm, order of commands to solve a problem
  • syntax, describes how to write commands
  • compiler, computer program for translation of high-level to low-level = machine code, the translation result is a complete runnable computer program in machine code
  • interpreter, computer program, which while executing a high-level program translates the next command“on the fly” into machine code
  • expression, e.g. 1 + 23 * 5
  • variable, place to store the result of math. Expressions for later processing

Now, let us do something real. Here comes our first KBasic program:



PRINT "Hello!"


PRINT "This is my first program!"

This is just a list of commands that the computer will interpret and execute. Go up to the “RUN” menu and click “START”. The screen will clear, and look something like this, with a “Press any key to continue” on the bottom of the screen.

This is my first program!

Notice it doesn't say CLS, or PRINT, or anything. To begin with the explanation, the command 'CLS' stands for Clear Screen, and PRINT is quite self-explanatory. Just make sure that when you're PRINTing, have quotes on each side of what you want the screen to display. Fool around with the two commands until you get used to them.

IMPORTANT!! The following program line tells KBasic that it should run your program in old style code.

These lines have to be placed on top in all example programs discussed in this 'Learning Coding' tutorial programs examples, otherwise you will run into a syntax error, because modern BASIC is expected. But for some reasons it is useful to start as a beginner at that old style, just to learn some simple rules and ideas of programming.

To be continued…

That's it! Thanks for reading and trying and have lot of fun with KBasic.

Using The Mouse

KBasic HOWTO Last Updated: March 2006

The mouse can be used for a lot more than just clicking.

Basic mouse usage

Operation Examples of use
Click left button Select a control
Click right button Context menu
Click, move mouse, let go Move control around
Hold Ctrl and click Select multiple controls

Using The Keyboard

KBasic HOWTO Last Updated: March 2006

You can navigate a lot faster using the keyboard, so be sure to read this page. Some operations have multiple shortcuts; use those you find most convenient.

Standard keys Movement

Keypresses Action
Backspace Deletes the character to the left of the cursor.
Delete Deletes the character to the right of the cursor.
Ctrl+C Copy the selected text to the clipboard.
Ctrl+Insert Copy the selected text to the clipboard.
Ctrl+K Deletes to the end of the line.
Ctrl+V Pastes the clipboard text into text edit.
Shift+Insert Pastes the clipboard text into text edit.
Ctrl+X Deletes the selected text and copies it to the clipboard.
Shift+Delete Deletes the selected text and copies it to the clipboard.
Ctrl+Z Undoes the last operation.
Ctrl+Y Redoes the last operation.
LeftArrow Moves the cursor one character to the left.
Ctrl+LeftArrow Moves the cursor one word to the left.
RightArrow Moves the cursor one character to the right.
Ctrl+RightArrow Moves the cursor one word to the right.
UpArrow Moves the cursor one line up.
DownArrow Moves the cursor one line down.
PageUp Moves the cursor one page up.
PageDown Moves the cursor one page down.
Ctrl+End Moves the cursor to the end of the text.
Alt+Wheel Scrolls the page horizontally (the Wheel is the mouse wheel).

System keys

Find text Ctrl + F
Open file Ctrl + O
Save file Ctrl + S

Create A New Project

KBasic HOWTO Last Updated: March 2006

Projects keep your work together. When developing an appication in KBasic, you work mainly with projects. A project is a collection of files that make up your KBasic application. You create a project to manage and organize these files. KBasic provides an easy yet sophisticated system to manage the collection of files that make up a project. The project window shows each item in a project. Starting a new application with KBasic begins with the creation of a project. So before you can construct an application with KBasic, you need to create a new project. A project consists of many separate files collected in one project directory, where one *.kbasic_project file is and many other files:

  • *.kbasic_module
  • *.kbasic_class
  • *.kbasic_form

In your KBasic-application forms are not only masks for inputting and changing data, but they are the graphical interface of your application. In the eyes of the beholder, they are the application! By creating your application using forms, you control the program flow with events, which are raised in the forms.

Each form in a KBasic application has got a form module with event procedures. Those event procedures react on events raised in the form. Additionally, every module can contain other non-event procedures. A form module is part of every form, when you copy a form, its form module is automatically copied, too. If you delete a form, its form module is deleted as well. KBasic creates a form module automatically. So you need only to write the event procedures and other procedures.

Forms hold your KBasic program together!

The KBasic development environment The KBasic development environment contains windows, toolbars, and editors that make developing your KBasic application easy. It is actually an integrated development environment (IDE). When a development environment is said to be intergrated, this means that the tools in the environment work together. For example, the compiler might find an error in the source code. In addition to displaying the error, KBasic opens the source file in the text editior and jumps to the exact line in the source code, where the error occurred. A large part of application development involves adding and arranging controls on forms. KBasic provides tools to make designing forms a simple process.

Windows KBasic windows are the areas on your screen that you use to develop your programs, including monitoring the status of your projects at any time. These windows include:

Form designer – drag and drop controls, as well as arrange them in this main development area. It is the primary tool you use to create your programs. Project window – work with the different parts of your project in this window. Its views include objects and files.

Property window – lists and lets you control the properties for your controls. You can resize, name, change visibility, assign values, and change colors and fonts of your controls.

Toolbox window – the central place where often used controls can be accessed

Source code editor – it is where you add and customize source code for your project in any phase of the development cycle.

Toolbars KBasic provides an extensive set of toolbars. Toolbars can be docked in the KBasic window or floated on the screeen.

Editor KBasic has one editor for creating and managing KBasic projects. You can use this editor to control the development of your projects, such as editing source code and manipulating classes. The source code editor is a tool for editing source code.

Create A Stand-Alone Application

KBasic HOWTO Last Updated: December 2009

KBasic created the binary file (EXE on Windows, bin on Linux) by copying kbrun.exe and adding the generated pcode and some information about this pcode to the end of that new file.

Another option is to copy kbrun.exe and the pcode file runtime.pcode and start kbrun.exe with the option ”-pcode runtime.pcode” (-pcode PATH). (Select in the binary creator: separate runtime and pcode)

Single File with all project files included

Give away a binary file using the KBasic compiler (Professional Edition only). If you compile a project, the binary file may contain many files of that project. All files are included in one large file.

For Windows:

Attention! You must always deploy some DLL files with your program (you will find it in the deployment installation directory of your project):

Basic requirement (at least):

  • QtCore4.dll
  • QtGui4.dll
  • msvcm90.dll
  • msvcp90.dll
  • msvcr90.dll
  • Microsoft.VC90.CRT.manifest
  • + All files in plugins. Some plugins may be removed. It depends on what features you use.

If you use the movie or sound related controls:

  • phonon4.dll

If you use the webview control:

  • QtWebKit4.dll
  • QtNetwork4.dll
  • phonon4.dll

If you use SVG:

  • QtSvg4.dll

If you use MySQL:

  • libmySQL.dll
  • QtSql4.dll

If you use PostgreSQL:

  • QtSql4.dll
  • + The rest of the not listed files yet.

Deployed for future releases (optional):

  • QtOpenGL4.dll
  • QtXml4.dll
  • QtXmlPatterns4.dll

For Linux:

Qt files are not provided by the compiler for Linux, because you cannot run shared libraries in a non-library directory. Therefore, all needed files must be installed on the target machine.

For Mac:

Attention! You must always deploy some dylib files with your program (you will find it in the deployment installation directory of your project):

Basically, it is like the Windows deployment.

Create An Installer For Your Application

KBasic HOWTO Last Updated: March 2006

For each platform you would like to support with your application you need an installer. There are several free installers you can use.

For Windows:

Inno Setup is a free installer for Windows programs. First introduced in 1997, Inno Setup today rivals and even surpasses many commercial installers in feature set and stability.

For Linux:

Try the several available package managers for Linux.

For Mac:

With Mac OS X and Disk Utility together with Packager is a InstallShield / Demoshield like installation tool for your applications written for Mac OS X. You can use it for free. Create a self-executable installation binary for Mac in two minutes. See your Mac OS X documentation and installation for details.

Or try

Migrate From VB6/VB.NET

KBasic HOWTO Last Updated: March 2006

KBasic supports 100% of the syntax of VB6. Many components are equal as well. It is possible to develop GUI applications with well known BASIC syntax in a modern fashion. It comes with truly Java-like object orientation and backward support for VB6 and QBasic, as it is 100% syntax compatible. KBasic combines the expressive power of object-oriented languages like C++ with the familiarity and ease of use of VB6. It allows developers with an installed base of VB6 applications to start developing for a mixed Windows, Mac OS X and Linux environment without having to face a steep learning curve: KBasic uses the familiar visual design paradigm and has a full implementation of the BASIC language.

Some information which might help you to migrate are listed in the following:

  • do not use ( ) to access arrays, better use [ ]
  • do not use 'Option OldBasic' or 'Option VeryOldBasic'
  • do not use 'On Error Goto', better use 'Try Catch'
  • do not use 'Nothing', better use 'Null'
  • avoid the use of the data type 'Variant'
  • do not use 'class_initialisize', better use 'Constructor', the same for the destructor
  • do not use 'Call' when calling a sub or function
  • do not use 'Optional' and 'IsMissing' with arguments in subs or functions, better use the default value of an argument
  • always use 'Do While…Loop' and 'Do …Loop While' instead of the other loops
  • always write many comments in your source code
  • use in conditions 'AndAlso' and 'OrElse' instead of the binary operators 'And' and 'Or'
  • avoid the use of 'ByRef' with primitive data types to get faster execution speed
  • do not use 'Data' and 'Def*', like 'DefInt'
  • use enumerations instead of many integer constants
  • use constants instead of the use of numeric literals many times in your source code
  • avoid the use of 'GoSub', better use real functions or real subs
  • avoid the use of 'GoTo', better use loops and other control flow language elements
  • 'Let' and 'Set' are not needed
  • use 'For Each', when it is possible
  • use 'For i As Integer = 0 To 10 Next', instead of declaring the counter variable outside of the loop
  • name the variable names without giving them suffixes
  • always use ( ) when you call a sub or function


KBasic HOWTO Last Updated: March 2006

The following chapter has been used from Wikipedia entry about SQL and is licensed under the GNU Free Documentation License.

SQL (commonly expanded to Structured Query Language) is the most popular computer language used to create, modify, retrieve and manipulate data from relational database management systems. The language has evolved beyond its original purpose to support object-relational database management systems. It is an ANSI/ISO standard.

SQL is designed for a specific, limited purpose — querying data contained in a relational database. As such, it is a set-based, declarative computer language rather than an imperative language such as C or BASIC which, being programming languages, are designed to solve a much broader set of problems. SQL keywords fall into several groups.

Data retrieval

The most frequently used operation in transactional databases is the data retrieval operation. When restricted to data retrieval commands, SQL acts as a functional language.

SELECT is used to retrieve zero or more rows from one or more tables in a database. In most applications, SELECT is the most commonly used DML command. In specifying a SELECT query, the user specifies a description of the desired result set, but they do not specify what physical operations must be executed to produce that result set. Translating the query into an efficient query plan is left to the database system, more specifically to the query optimizer.

Commonly available keywords related to SELECT include:

FROM is used to indicate from which tables the data is to be taken, as well as how the tables join to each other.
WHERE is used to identify which rows to be retrieved, or applied to GROUP BY. WHERE is evaluated before the GROUP BY.
GROUP BY is used to combine rows with related values into elements of a smaller set of rows.
HAVING is used to identify which of the “combined rows” (combined rows are produced when the query has a GROUP BY keyword or when the SELECT part contains aggregates), are to be retrieved. HAVING acts much like a WHERE, but it operates on the results of the GROUP BY and hence can use aggregate functions.
ORDER BY is used to identify which columns are used to sort the resulting data.

Example 1:

SELECT * FROM books WHERE price > 100.00
ORDER BY title

This example shows the records for all books that cost more than 100.00 (units of currency). The result is sorted alphabetically by book title. The asterisk (*) means to show all columns of the referenced table(s). Alternatively, specific columns could be named. Example 2:

 SELECT bk.title, count(*) AS Authors
 FROM books AS bk, book_authors AS ba
 WHERE bk.book_number = ba.book_number
 GROUP BY bk.title

Example 2 shows both the use of multiple tables (called a “join”), and aggregation (grouping). “bk” and “ba” are known as “table aliases” and help avoid ambiguity when performing joins. (“AS” is optional in many dialects.) This example shows how many authors there are per book. Example output may resemble:

Title                   Authors
----------------------  -------
SQL Examples and Guide     3
The Joy of SQL             1
How to use Wikipedia       2
Pitfalls of SQL            1
How SQL Saved my Dog       1

Data manipulation

First there are the standard Data Manipulation Language (DML) elements. DML is the subset of the language used to add, update and delete data.

INSERT is used to add zero or more rows (formally tuples) to an existing table.
UPDATE is used to modify the values of a set of existing table rows.
MERGE is used to combine the data of multiple tables. It is something of a combination of the INSERT and UPDATE elements. It is defined in the SQL:2003 standard; prior to that, some databases provided similar functionality via different syntax, sometimes called an “upsert”.
TRUNCATE deletes all data from a table (non-standard, but common SQL command).
DELETE removes zero or more existing rows from a table.


INSERT INTO my_table (field1, field2, field3) VALUES ('test', 'N', NULL);
UPDATE my_table SET field1 = 'updated value' WHERE field2 = 'N';
DELETE FROM my_table WHERE field2 = 'N';

Data transaction

Transaction, if available, can be used to wrap around the DML operations. START TRANSACTION (or BEGIN WORK, depending on SQL dialect) can be used to mark the start of a database transaction, which either completes completely or not at all.

COMMIT causes all data changes in a transaction to be made permanent.
ROLLBACK causes all data changes since the last COMMIT or ROLLBACK to be discarded, so that the state of the data is “rolled back” to the way it was prior to those changes being requested.

COMMIT and ROLLBACK interact with areas such as transaction control and locking. Strictly, both terminate any open transaction and release any locks held on data. In the absence of a START TRANSACTION or similar statement, the semantics of SQL are implementation-dependent. Example:

UPDATE inventory SET quantity = quantity - 3 WHERE item = 'pants';

Data definition

The second group of keywords is the Data Definition Language (DDL). DDL allows the user to define new tables and associated elements. Most commercial SQL databases have proprietary extensions in their DDL, which allow control over nonstandard features of the database system. The most basic items of DDL are the CREATE and DROP commands.

CREATE causes an object (a table, for example) to be created within the database.
DROP causes an existing object within the database to be deleted, usually irretrievably.

Some database systems also have an ALTER command, which permits the user to modify an existing object in various ways – for example, adding a column to an existing table. Example:

CREATE TABLE my_table (
my_field1   INT          UNSIGNED,
my_field2   VARCHAR (50),
my_field3   DATE         NOT NULL,
PRIMARY KEY (my_field1, my_field2) 

Data control

The third group of SQL keywords is the Data Control Language (DCL). DCL handles the authorization aspects of data and permits the user to control who has access to see or manipulate data within the database. Its two main keywords are:

GRANT — authorises one or more users to perform an operation or a set of operations on an object.
REVOKE — removes or restricts the capability of a user to perform an operation or a set of operations.


GRANT SELECT, UPDATE ON my_table TO some_user, another_user

Read more about SQL:


KBasic Software is always looking for someone to translate the manual! If you would like to help KBasic to spread, please contact Thanks in advance.

The HTML version of the documentation is the most updated one. For English HTML documentation see MANUALS

A list of available resources useful for working with KBasic.

PDF-File: The KBasic Manual (Italian Version)

PDF-File: The KBasic Manual (German Version: Das KBasic Handbuch)

PDF-File: The KBasic Manual (English Version)

PDF-File: The KBasic Syntax (English Version)

More files

PDF-File: About KBasic (English Version)

PDF-File: Overview (English Version)

PDF-File: KBasic Framework (English Version)

PDF-File: Keywords (English Version)

PDF-File: Built-in Functions (English Version)

PDF-File: Misc. Issues (English Version)

PDF-File: Manual (English Version based on the website entries)

PDF-File: Syntax (English Version based on the website entries)

An InstallShield / Demoshield like installation tool for your applications written for Linux. You can use it for free. Create a self-executable installation binary for Linux in two minutes.

Download: Linux Installer Packager

manuals.txt · Last modified: 2013/06/04 13:43 by berndnoetscher