Professional Documents
Culture Documents
By Mbogo Njoroge
1 2
3 4
Start
User Interface Speakers
Convert audio
Get frequency settings and signal into sound
volume settings from user
Set Frequency/
Start receiving/
Stop receiving
7 8
OOP Terminology
What is an object?
The VB.2010 IDE
An object in the context of object-oriented programming is
anything that software developers are interested.
• VB.Net Integrated Development
Environment (henceforth referred to as the
Software objects model the real-world objects, which may be IDE) window shown in the next slide with a
visible or invisible, something one can touch or untouchable;
few of its main components. It provides a
something that has weight or weightless.
good environment with ready to use tools
Sample objects: which the application
Car, person, employee, air, credit, receipt and account. developers/programmer uses when creating
programs
9 10
The IDE
IDE Components
• Solution Explorer - this window contains a list of all open
projects and files/items associated with the current solution.
• Form designer - this window is where all controls for a given
solution will be placed and manipulated. A windows
application may have one, two or many windows forms
associated with it. Note a console application will have no form
designer window, nor toolbox, since a console application
contains no forms.
• Toolbox - this window is where all VB controls will be
retrieved from. In actuality, you can consider the items in the
toolbox as class containers. Retrieving a control from the
toolbox is analogous to instantiating an object from that class.
Thus clicking on the button item (class) in the toolbox will give
you a button object. You can either double click on the control
Code you wish to add to the form, or you can drag and drop your
5 control.
Window
• Properties - this window is where property values are set for a
11 given control 12
3/2/2024
17 18
3/2/2024
19 20
• Each property has a value (or values) The label controls use the default names (Label1, etc.)
Step in Developing an Application Program Step 3: Make a list of the controls needed
Eg:
using VB.Net Type Name Description
TextBox txtHoursWorked Allows the user to enter the number of hours worked.
• Step 1: Clearly define what the program is to do TextBox txtPayRate Allows the user to enter the hourly pay rate
For example, the Wage Calculator program: Label lblGrossPay Displays the gross pay, after the btnCalcGrossPay
– Purpose: To calculate the user’s gross pay button has been clicked
Button btnCalcGrossPay When clicked, multiplies the number of hours worked
– Input: Number of hours worked, hourly pay rate by the hourly pay rate
– Process: Multiply number of hours worked by hourly pay rate Button btnClose When clicked, terminates the application
(result is the user’s gross pay) Label (default) Description for Number of Hours Worked TextBox
– Output: Display a message indicating the user’s gross pay Label (default) Description for Hourly Pay Rate TextBox
Label (default) Description for Gross Pay Earned Label
• Step 2: Visualize the application running on the computer Form (default) A form to hold these controls
and design its user interface
Step 4: Define values for each control's relevant properties:
Eg:
Control Type Control Name Text
Form (Default) "Wage Calculator"
Label (Default) "Number of Hours Worked"
Label (Default) "Hourly Pay Rate"
Label (Default) "Gross Pay Earned"
Label lblGrossPay "$0.00"
TextBox txtHoursWorked ""
TextBox txtPayRate ""
27 Button btnCalcGrossPay "Calculate Gross Pay" 28
Button btnClose "Close"
Step 5: List the methods needed for each control: Step 7: Check the code for errors:
Eg: – Read the flowchart and/or pseudocode
Method Description
btnCalcGrossPay_Click Multiplies hours worked by hourly pay rate – Step through each operation as though you are the
These values are entered into the computer
txtHoursWorked and txtPayRate TextBoxes
– Use a piece of paper to jot down the values of variables
Result is stored in lblGrossPay Text property
btnClose_Click Terminates the application and properties as they change
– Verify that the expected results are achieved
Step 6: Create pseudocode or a flowchart of each method:
• Create pseudocode or a flowchart of each method:
– Pseudocode is an English-like description in programming Step 8: Use Visual Basic to create the forms and other
language terms controls identified in step 3:
Store Hours Worked x Hourly Pay Rate in sngGrossPay.
Store the value of sngGrossPay in lblGrossPay.Text.
– This is the first use of Visual Basic, all of the previous
– A flowchart is a diagram that uses boxes and other steps have just been on paper
symbols to represent each step – In this step you develop the portion of the application
Multiply hours Copy value in the user will see
worked by sngGrossPay to
Start hourly payrate. End
lblGrossPay
Store result in text property
sngGrossPay. 29 30
3/2/2024
31 32
Overview on .NET
.NET is not a single programming language but a pack of Common Language Runtime (CLR)
programming environments of Visual Languages that includes:
.Net Framework provides runtime environment
– Visual Basic called Common Language Runtime (CLR) in which ALL the
– Visual J# .Net Programs are run.
– Visual C++ The code which runs under the CLR is called Managed Code.
– Visual C# Programmers need not worry on managing the memory if the
All these languages has the same source code and supported programs are running under the CLR as it provides memory
on a common .NET Framework management and thread management.
The .NET Framework:
Programmatically, when our program needs memory, CLR
.Net Framework is a platform that provides tools and technologies
allocates the memory for scope and de-allocates the memory if
to develop Windows, Web and Enterprise applications. It mainly
contains two components,
the scope is completed.
It provides a common set of services that can be used when Language Compilers such as C#, VB.Net, J# converts the
programming in any supported language • Enabling a Code/Program to Microsoft Intermediate Language (MSIL)
programmer to write programs that run on any operating intern this will be converted to Native Code by CLR (See the
system on any hardware platform figure description on next slide)
Its main components are two;
1. .NET Framework Class Library (FCL) 33 34
2. Common Language Runtime (CLR)
Compilation of Visual Basic .NET Source Code, Object Code and Executable Code
•The bytecode created by the VB .NET compiler must be
•Source code refers to the program written in a high-level
interpreted by the Microsoft Common Language Runtime
(CLR) interpreter before the CPU can execute it.
language.
•The CLR is part of Microsoft .NET platform. •Object code is the machine language version of the
source code.
•The runtime files of Microsoft .NET platform is part of
Microsoft Visual Studio .NET and can also be downloaded •Executable code is created from the object code and
from the Microsoft web site.
necessary software library components. The executable
code is ready to be run on an operating system.
language-specific CLR and JIT •In Microsoft Windows operating system, a file with file
.NET compiler compiler native machine
IL types of .exe holds the executable code.
program code
37 38
AndAlso
OrElse
IsFalse
IsTrue
* Complete this table by filling in the blank rows of the second and third columns *
*Draw truth tables for each of the operators AND, OR, NOT, and XOR * 41 42
3/2/2024
43 44
Properties Settings
The Properties
window lists the
design-time
properties for
selected objects and
their current
settings. You can
change these
properties at design
Exercise time. When you
a) Whats the name of the currently selected controle? select multiple
controls, the
b) Identify the property-value setting for the properties;
Properties window
i. Multiline contains a list of the
ii. ShortcutEnabled properties common
iii. Size to all the selected
45 46
iv. Text controls