ICT 10 - Lecture
ICT 10 - Lecture
College Mathematicians and computer scientists who invented BASIC at the Dartmouth College in U.S. state of
New Hampshire. They designed BASIC to allow students to write main frame computer programs for the
Dartmouth Time-Sharing System – the first large-scale time-sharing system to be implemented successfully.
BASIC was intended specifically for less technical users who did not have or want the mathematical
background previously expected.
Alan Cooper
VB.NET provides the easiest, most productive language and tool for rapidly building Windows and Web
applications.
IDE Integrated Development Environment
2 Types of VB Applications
1. Console Application command prompt/DOS Screen
2. Windowed (GUI) Application
.NET Framework Microsoft’s strategy of software that provides services to people any time, any place, on any
device.
an XML Web Services platform which allows us to build rich wide range of smart devices such as tablet
devices, pocket PCs, web phones, etc.
Web Services applications that run on a web server and communicate with other applications. It uses a series of
protocols to respond to different requests.
CLR (Common Language Runtime) described as the “execution engine” of .NET. IT provides the
environment within which the programs run.
CLS (Common Language Specification) describes a set of features that different languages have in
common. It defines the minimum standards that .NET language compilers must conform to.
Some reasons why developers are building applications using the .NET Framework:
1. Improved Reliability
2. Increased Performance
3. Developer Productivity
4. Powerful Security
5. Integration with existing systems
6. Ease of Deployment
7. Mobility Support
8. XML Web Service Support
Concepts of OOP:
1. Objects basic runtime entities in an object-oriented system. When a program is executed, objects interact
with each other by adding sending messages.
2. Class a collection of objects of similar type
3. Abstraction refers to the act of representing essential features without including the background details or
explanation.
4. Encapsulation sharing data and functions in a single unit
5. Inheritance process by which objects can acquire the properties of objects of other class
o Subclass class that inherits from another class (child class)
o Super Class class that gives inheritance to other classes (parent class)
6. Polymorphism refers to a programming language’
o Method Overloading (Static Polymorphism) there are several methods present in a class
having the same name but different types/order/number of parameters.
o Method Overriding (Dynamic Polymorphism) it allows a subclass or child class to provide
specific implementation of a method that is already provided by one of its super classes or parent
class.
VB PROGRAMMING TERMINOLOGIES
1. Statement a complete instruction. It can contain keywords, operators, variables, literals, expressions, and
constants.
a. Declaration statement statement that can create a variable constant and data type
b. Executable statement are the statements that perform an action
2. Comment begins with single quote (‘) character and following statements that are ignored by the compiler
These are generally used to specify what is going on in the program and also gives an idea about the flow
of the program.
4. Access Modifiers – lets us specify how a variable, method or a class can be used
5. Variables used to store data. A variable has a name to which we refer and data type. Variables are
declared with Dim keyword, which stands for Dimension.
Expressions a series of value elements combined with operators, which yields a new value.
Types of Operators
a. Arithmetic Operators used to perform arithmetic operations that involve calculation of numeric
values.
Operato USE
r
^ Exponentiation
- Negation (used to reverse the sign of the given value)
* Multiplication
/ Division
\ Integer Division
Mod Modulus Division (used for getting the remainder)
+ Addition
- Subtraction
Operato USE
r
= Equality
<> Inequality
< Less Than
> Greater Than
<= Less Than or Equal to
>= Greater Than or Equal to
c. Concatenation Operators join multiple strings into a single string. There are two concatenation
operators, + and &.
d. Logical/Bitwise Operators compare Boolean expressions and return Boolean result. In short,
logical operators are expressions which return a true or false result over a conditional expression.
Operato USE
r
Not Negation
And Conjunction
AndAlso Conjunction
Or Disjunction
OrElse Disjunction
Xor Disjunction
CONSOLE APPLICATION
one that looks like a DOS window
SOLUTION EXPLORER
Is where all the files for your project are located
SAVE ALL
The command that must be clicked to save your project, or by simply pressing Ctrl + Shift + S
PROJECTS FOLDER
Folder under Documents/Visual Studio 2013, where all your projects are located
METHOD
Set of codes that does a particular job
INTELLISENSE
A pop-up menu that tries to guess what you want, and allows you to quickly add the item from the
list.
WINDOWS FORM
the name given to a graphical (GUI) class library included as a part of Microsoft .NET
Framework, providing a platform to write rich client applications for desktop, laptop, and tablet
PCs.
CONTROLS
These are the objects that you can add to your form like buttons, text boxes, menus, check boxes,
radio buttons, etc.
PROPERTIES
Contains the properties of control like Height, Width, Name, Text, and a whole lot more..
TOOLBOX
Contains all the Controls that you may be adding to your form.
BUTTON
An object that you want the user to click on
WINDOWS FORM a graphical (GUI) class library included as a part of Microsoft .NET Framework, providing a
platform to write rich client applications for desktop, laptop, and tablet PCs.
FORM CONTROLS the objects that may be added into a form such as buttons, textboxes, labels, etc.
EVENTS these enable a class or object to notify other classes or objects when something of interest occurs. The
class that sends (or raises) the event is called the publisher and the classes that receive (or handle) the event are
called subscribers.
ENUMERATION (enum) a distinct type that consists of a set of named constants called the enumerator list.
type anything inside it. Items this property contains the SelectedIndex property
Alternatively, he or she can the strings that are found in changes.
select something from the list. the drop-down part of the
ComboBox.
DropDownStyles this
controls the appearance and
functionality of the ComboBox.
NumericUpDown A textbox with a number and Increment determines how ValueChanged occurs
two scroll buttons to change far the control will change its when the value in the up-
the value. value up or down depending on down control changes.
the arrow clicked.
DecimalPlaces allows you
to set the number of digits that
come after the decimal place in
the NumericUpDown control.
ThousandsSeparator
indicates whether a separator
will be inserted between every
3 decimal digits.
RadioButton Enables the user to select a Checked indicates whether CheckedChanged
single button from a group of the radio button is checked or occurs whenever the
choices when paired with not, usually set to true to set ‘Checked’ property is
other RadioButtons. default checked RadioButton. changed.
GroupBox Displays a frame around a Enabled indicates whether Enter occurs when the
group of controls with an the control is enabled. control becomes the active
optional caption. control of the form.
Label Provides run-time information Text shows the text Click occurs when the
or descriptive text for a associated with the control. component is clicked.
control.
ListBox Displays a list from which the Items the items a ListBox SelectedIndexChanged
user can select items. contains. occurs when the value of
DataSource Indicates the the SelectedIndex property
list that this control will use to changes.
get its items.
ListView Displays a collection of items Columns columns shown in SelectedIndexChanged
in one of five different views. Details view. occurs when the value of
Items the items a ListView the SelectedIndex property
contains. for this ListView changes.
HeaderStyle the style of
the column headers in Details
View.
GridLines displays lines
around items and subitems,
only shown when in Details
view.
RichTextBox Provides advanced text entry Locked determines if we TextChanged event
and editing features such as can move or resize the control. raised when the value of
character and paragraph WordWrap indicates the the Text property is
formatting. automatic arrangement of text changed in control.
in lines of specified length
without the necessity of
pressing the Enter key.
ZoomFactor defines the
current scaling factor of the
RichTextBox display, 1.0 is
normal viewing.
TextBox Enables the user to enter text, Name indicates the name TextChanged event
and provides multiline editing used in the code to identify the raised when the value of
and password character object. the Text property is
masking. TextAlign indicates how the changed in control.
text should be aligned for edit
controls.
PasswordChar indicates
BackColor The background color of the Margin Specifies space between this control and
component. another control’s margin.
FlatStyle Determines the appearance of the MaximumSize Specifies the maximum/minimum size of
control when a user moves the mouse MinimumSize a control.
over the control and clicks.
Font Font used to display the text in the Size The size of the control in pixels.
control.
ForeColor The foreground color of a control, Visible Determines whether the control is visible
which is used to display text. or hidden.
MessageBox displays a message window, also known as a dialog box, which presents a message to the user. It is a
modal window, blocking other actions in the application until the user closes it. A MessageBox can contain text,
buttons, and symbols that inform and instruct the user.
Caption
Icon Text
Button/s
Namespace: System.Windows.Forms
Method: Show(String, String, MessageBoxButtons, MessageBoxIcon)
Description: Displays a message box with specified text, caption, buttons, and icon.
MessageBoxIcons ENUMERATION
MEMBERS DESCRIPTION
AbortRetryIgnore The message box contains Abort, Retry, and Ignore buttons.
OK The message box contains an OK button.
OKCancel The message box contains OK and Cancel buttons.
RetryCancel The message box contains Retry and Cancel buttons.
YesNo The message box contains Yes and No buttons.
YesNoCancel The message box contains Yes, No, and Cancel buttons.
DECISION STRUCTURES
1. If … Then STATEMENT
a. Single-line statement
b. Block statement
c. Multiple Conditions
1. While Loop this keeps executing until the condition against which it tests remain true.
2. Do Loop this can be used to execute a fixed block of statements indefinite number of times. It also keeps
executing its statemets while or until the condition is true. Two keywords, while and until, can be used with
the Do loop. The Do loop also supports an ExitDo statement which makes the loop exit at any moment.
3. For Loop the most popular loop. This enable us to execute series of expressions multiple number of times.
The For loop in VB.NET needs a loop index which counts the number of loop iterations as the loop executes.
If index = 10 Then
Exit For
End If
Next
1. BUTTON a control, which is an interactive component that enables users to communicate with
an application which we click and release to perform some actions.
Ex. ComboBox1.Items.Add("Sunday")
ComboBox1.Items.Add("Monday")
ComboBox1.Items.Add("Tuesday")
Ex. ComboBox1.Items.RemoveAt(1) or
ComboBox1.Items.Remove("Monday")
DropDownStyle (Property) property that specifies whether the list is always displayed or
whether the list is displayed in a drop down. It also specifies whether the text portion can be
edited.
SelectedIndexChanged (Event) executes when your selection change in the combobox. If
you want some actions when you change the selection, you can write the code on this event.
3. LIST BOX displays a list of choices in a box which the user can select from.
4. RADIO BUTTON a type of graphical user interface element that allows the user to choose only
one of a predefined set of options.
CheckAlign (Property) determines the location of the button / box inside the control
Checked (Property) indicates whether the radio button is active (on) or not (off).
CheckedChanged (Event) executes when the checked property of the radio button
changes.
5. CHECK BOX GUI control that allows the user to make multiple selections from a number of
options.
Checked (Property) indicates whether the component or control is in the “checked” state.
CheckState (Property) indicates the state of the component or control
6. PICTURE BOX used to display images in bitmap, GIF, icon, or JPEG formats.
FromFile (Function) function under the Image class used to create an image from the
specified file.
Image (Property) the image resource displayed in the control.
SizeMode (Property) controls how the PictureBox will handle image placement and control
sizing.
o Normal The image is placed in the upper-left corner of the PictureBox or the image is
clipped if it is larger than the PictureBox it is contained in.
o StretchImage The image within the PictureBox is stretched or shrunk to fit the size of
the PictureBox.
o AutoSize The PictureBox is sized equal to the size of the image that it contains.
o CenterImage The image is displayed in the center if the PictureBox is larger than the
image. If the image is larger than the PictureBox, the picture is placed in the center of the
PictureBox and the outside edges are clipped.
o Zoom The size of the image is increased or decreased maintaining the size ratio.
StreamReader CLASS Implements a TextReader that reads characters from a byte stream in a particular
encoding.
Namespace: System.IO
Method: ReadToEnd() - Reads all characters from the current position to the end of the
stream.
ReadLine() - Reads a line of characters from the current stream and returns the
data as a string.
File CLASS Provides static methods for the creation, copying, deletion, moving, and opening of a single
file, and aids in the creation of FileStream objects.
Namespace: System.IO
Method: Copy (String, String) - Copies an existing file to a new file. Overwriting a file
of the same name is NOT allowed.
Copy (String, String, Boolean) - Copies an existing file to a new file. Overwriting a file
of the same name is allowed.
Move (String, String) - Moves a specified file to a new location, providing the
option to specify a new file name.
fileReader = My.Computer.FileSystem.OpenTextFileReader(fileName)
If File.Exists(fileName) Then
txtOutput.Text = fileReader.ReadToEnd()
fileReader.Close()
Else
MessageBox.Show("No Such file " + fileName)
End If
End Sub
fileReader = My.Computer.FileSystem.OpenTextFileReader(fileName)
txtOutput.Text = textLine
fileReader.Close()
End Sub
Namespace: System.IO
SAMPLE PROGRAM:
MessageBox.Show("Wrote File!")
End Sub
CBool(expression)
CByte(expression)
CChar(expression)
CDate(expression)
CDbl(expression)
CDec(expression)
CInt(expression)
CLng(expression)
CObj(expression)
CSByte(expression)
CShort(expression)
CSng(expression)
CStr(expression)
CUInt(expression)
CULng(expression)
CUShort(expression)
The function name determines the data type of the value it returns, as shown in the following table.
Function Return
name data type Range for expression argument
Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-
point to byte conversion with the CByte function; see the Remarkssection for more
information. See the CInt Example section for an example.
CChar Char Data Any valid Char or String expression; only first character of a String is converted;
Type value can be 0 through 65535 (unsigned).
Function Return
name data type Range for expression argument
Type
Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-
point to 64-bit integer conversion with the CLng function; see the Remarks section
for more information. See the CInt Example section for an example.
Function Return
name data type Range for expression argument
CSng Single -3.402823E+38 through -1.401298E-45 for negative values; 1.401298E-45 through
Data 3.402823E+38 for positive values.
Type
Function Return
name data type Range for expression argument
example.
1
Fractional parts can be subject to a special type of rounding called banker's rounding. See "Remarks"
for more information.