Hello World

It is often the case that the first computer program people learn to write is one which displays a simple message, and traditionally that message is Hello World. You can find out more about why this is the case in this Wikipedia article .

There are 2 steps to writing this program.

STEP 1: Arrange the window layout

For this program we will need three components:

1. A StaticText RB_Static_Text.jpg field to display a heading

2. An EditField RB_EditField.jpgto display the message "Hello World"

3. A PushButton RB_Push_Button.jpgwhich will cause the message to be displayed when pressed

Drag these elements onto your window.
  • Change the caption of the PushButton so that it reads "Start"
  • Change the font of the StaticText field to make it bigger and centrally aligned, with the caption "My First Program"
  • Change the name of the EditField to read MessageField (note there is no space)


STEP 2: Write some code

We want the message "Hello World" to be displayed when the Start button is clicked by the user. This means we have to put this code in our Start button.

To do this, double-click on the Start Button. It will open up a new code window which should be blank. Copy the code below exactly as follows:

This simply means - when the Start button is pressed, set the Text property of MessageField to "Hello World"

Now you are ready to test your program. You can run any Real Basic program by clicking on the Run button:

Run your program, and click on the Start button. If you have managed to follow the instructions correctly, your program should display the message "Hello World" in the EditField.

If your program has not worked, go back and check that you entered the code above correctly.
Also check that you have changed the name of the EditField to MessageField.


Add 2 more buttons to your program. Each button should display a different message.