The Windows Forms Hello World application demonstrates the essential steps for creating a VCL Forms application. The application uses a VCL Form, a control, an event, and displays a dialog in response to a user action.
Creating the Hello World application consists of the following steps:
- Create a VCL.NET Form with a button control.
- Write the code to display "Hello World" when the button is clicked.
- Run the application.
To create a VCL Form
- Choose File
New
Other
Delphi for .NET Projects
VCL Forms Application. The VCL Forms Designer displays.
- Click the Design tab to display the form view.
- From the Standard category of the Tool Palette, place a TButton component on the form.
To display the "Hello World" string
- Select Button1 on the form.
- In the Object Inspector, double-click the OnClick event handler on the Events tab. The Code Editor appears, with the cursor in the TForm1.Button1Click event handler block.
- Place the cursor before the begin reserved word and then press Return. This creates a new line above the code block.
- Insert the cursor on the new line created, and type the following variable declaration:
- Insert the cursor within the code block, and type the following code:
s:= 'Hello World!';
ShowMessage(s);
To run the "Hello World" application
- Save your project files.
- Choose Run
Run to build and run the application. The form displays with a button called Button1.
- Click Button1. A dialog box displays the message "Hello World!".
- Click OK to close the message dialog.
- Close the VCL form to return to the IDE.