Itc2301 P2
Itc2301 P2
Itc2301 P2
PART TWO
VB.NET IDE
VB.NET objects
Writing VB.NET code
◦ Toolbox window
contains set of controls which make up a VB
application.
◦ Windows Form designer window
central part of VB. It provides the display area for
the application acts as a container for all the
controls
◦ Properties window
Each object in VB has a set of characteristics called
properties. This window contains the properties
that control the object’s appearance and behaviour.
Object box, Properties list, Description pane,
settings box
◦ Main window
At top of screen. Contains
title bar:
menu bar: displays commands used to build VB application
standard tool bar: quick access to commonly used menu commands
form, label, picturebox, button
demonstration
◦ Adding a control to a form
◦ sizing, moving and deleting a control
◦ setting properties of a control at design time
◦ changing properties for more than one control
Name – uniquely identifies the object in the program
Text– the caption of a button, contents of a text
box or label, the title of a form
Size.Height and Size.Width – the width and height of
the object (dimension in pixels)
Visible – Whether the object should be shown
Font – the face, style, and size of an objects font
BackColor, ForeColor – color of background or
foreground
EachVB.NET Graphical Object has an extensive list
of properties which can be individually set.
Qualities or attributes of an object/graphic-control
Can be changed by programmer
◦ design time – in the ‘properties’ box.
◦ Demo:
Lets run our application. What happens?
Programming involves understanding the Syntax and
Semantics of a particular programming language, to
form Statements that tell the computer what to do.
Statement
◦ An instruction to the computer (specifically, for the
compiler)
Syntax
◦ The rules for constructing valid statements
Semantics
◦ The meaning or interpretation of a statement
Statements are organised into a source-code file
The source code file is divided into sections:
◦ Class definition
◦ Form Layout information
◦ Global Variables and Constants
◦ New data type
◦ Procedures and Functions
Actions—such as clicking, double-clicking, and
scrolling—are called events
The set of Visual Basic .NET instructions, or
code, that tells an object how to respond to an
event is called an event procedure
You write statements inside an event procedure
to specify the individual steps required for the
input, processing and output.
To help you follow the syntax rules of the
Visual Basic .NET programming language, the
Code Editor provides you with a code template
for every event procedure
The first line in the Code template is called the
procedure header
And the last line is called the procedure footer
A keyword is a word that has a special meaning in a
programming language
The Sub keyword is an abbreviation of the term sub
procedure, which, in programming terminology,
refers to a block of code that performs a specific task
The Private keyword indicates that the procedure can
be used only within the class in which it is defined
VB.NET provides Code Template for each Event Procedure
Example:
Public Class Form1
Inherits System.Windows.Forms.Form