Page 47 - Computing Book 8
P. 47
Developing Applications – Visual Studio Class 8
15. The important thing to remember is that the Text property in the Appearance section is for the
text written on it and the Name property in the design section is for giving a name to that
element in order to program it accordingly.
16. Designing of form layout is complete now we will program the control Button so when we click
the button it will trigger the command to show the text in the Label control.
17. Double click on the Button control and a script window will appear where there is a lot of code
already present relative to the button functionality, although we want this button to trigger our
desired text in the Label control.
18. Type the highlighted code between the
two lines as shown in this example:
Now click on the save all icon or press
Ctrl+Shift+S to save the whole project.
19. Click on the debug button or F5 to execute the program in
debugging mode. If there is an error in the program it will
show the warning/problem or else the program will execute.
20. The program window will appear and if you click the Say
Hello World button, the label’s text changes to Hello world!
Exactly as we have programmed.
Each time you test your program by clicking the Start Debugging
button, an application executable file is created in ...\Projects\[project name]\[project
name]\bin\Debug.
For example, for the First VB Form project, the .exe file can be found under
...\Projects\HelloWorldApplication\HelloWorldApplication\bin\Debug\HelloWorldApplication.exe.
Variables:
A variable is a container of data in a computer’s memory where the computer stores the different
types of data and this could be numeric or text. To create and access these Variable (data
containers) we name them so we can call them in our program where it is necessary.
Private and Public Variables
Public variables are variables that are accessible to the whole program. Private variables are
variables that are accessible only to a certain part of the program or code.
Declaring a Private Variable
In visual studio, we can declare the variable by the keyword Dim which is a short form for dimension.
For better understanding, we will create a program using 2 variables and calculate them to see its
working. Follow these steps to create a program with variables in it:
1. Create a new form and name that form
as “Variables”
2. Add 2 text fields from the toolbox in
the form
3. Add 1 button from the toolbox in the
form and change the name of the
The City School /Academics/Computing Curriculum/Class 8/2020-2021 Page 46 of 75

