Cambridge IGCSE & O Level Computer Science Programming Book for Microsoft Visual Basic Sample

Page 22

We are working with Cambridge Assessment International Education towards endorsement of this title. Any references or material related to answers, grades, papers or examinations are based on the opinion of the author(s).

Figure 1.8: Diagnostic tools window

LE

CAMBRIDGE IGCSE™ & O LEVEL COMPUTER SCIENCE: PROGRAMMING BOOK

Congratulations! Your first console application program is complete. Use the

Save All option under the FILE menu to save your project.

P

Note: Windows Forms application is optional content. It is not covered in the syllabuses.

1.6 Windows Forms application

M

Console application makes use of a single user interface to accept text-based inputs and display text-based outputs. Windows Forms application makes use of a range of Graphical User Interface (GUI) tools, to produce systems that have more in common with commercial applications. Windows Forms application is more complex as programmers need to design and produce the graphical user interface that will allow the user to interact with the system. Visual Basic is an event-driven procedural language in which events trigger subroutines that execute the code within them.

S

A

In Visual Basic, user-controlled events – such as pressing the Enter key or selecting a button on a GUI – control the execution of the code. This is known as event-driven programming. A common element of a Windows Forms application GUI is a button that can be selected by a user. When the button is selected, it will trigger the execution of code held in a subroutine that is linked to the button. As you develop more complex projects your GUI will include many different buttons that a user can select, each button triggering a different section of code held in a subroutine linked to that button. For example, a reset button would be linked to a subroutine that holds the code required to reset the project. In this first Windows Forms application, we will have a single button. Clicking this button on the form will trigger the code in the subroutine linked to the button that will deliver the message ‘Hello World’. To create a Windows Forms application, you will need to first create a new project (Figure 1.2) and select Windows Forms App (.NET Framework). You should give your project a meaningful name and select an appropriate storage location when you configure your project (Figure 1.3). The default layout of a Windows Forms application contains five main areas, these are shown in Figure 1.9 and described in Table 1.3.

10 Original material © Cambridge University Press 2021. This material is not final and is subject to further changes prior to publication.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Cambridge IGCSE & O Level Computer Science Programming Book for Microsoft Visual Basic Sample by Cambridge International Education - Issuu