Record MM It
Record MM It
Record MM It
(Deemed to be university)
1956)
COIMBATORE-
641021
UNIT II
The VB .Net Language: The VB .Net Language – Variables- declaring
variables, Data type of variables, forcing variables declarations, scope &
lifetime of a variable, constants, arrays, types of arrays, control array,
Structure programming – Modularity – Information hiding – abstraction
– events – subroutines and functions – message box – input box. Control
These are the major difference between these two languages. The next
1.Simplified Deployment
With Visual Basic .NET we can build applications more rapidly and
deploy and maintain them with efficiency. Visual Basic .NET 2003
and .NET Framework 1.1 makes "DLL Hell" a thing of the past. Side-by-
side versioning enables multiple versions of the same component to live
safely on the same machine so that applications can use a specific
version of a component. XCOPY-deployment and Web auto-download of
Windows- based applications combine the simplicity of Web page
deployment and maintenance with the power of rich, responsive
Windows-based applications.
Visual Basic .NET comes with features such as a powerful new forms
designer, an in- place menu editor, and automatic control anchoring and
docking. Visual Basic .NET delivers new productivity features for
building more robust applications easily and quickly. With an improved
integrated development environment (IDE) and a significantly reduced
startup time, Visual Basic .NET offers fast, automatic formatting of code
as you type, improved IntelliSense, an enhanced object browser and
XML designer, and much more.
5.Improved Coding
You can code faster and more effectively. A multitude of enhancements
to the code editor, including enhanced IntelliSense, smart listing of code
for greater readability and a background compiler for real-time
notification of syntax errors transforms into a rapid application
development (RAD) coding machine.
Visual Basic developers can have full access to the capabilities available
in .NET Framework 1.1. Developers can easily program system services
including the event log, performance counters and file system. The new
Windows Service project template enables to build real Microsoft
Windows NT Services. Programming against Windows Services and
creating new Windows Services is not available in Visual Basic .NET
Standard, it requires Visual Studio 2003 Professional, or higher.
Character set is nothing but the set of characters allowed and supported
in the programming language. Generally a program is a collection of
instructions, which contains group of characters. Only a limited set of
characters is allowed to write instructions in the program.
S.No Character Set Contents
1 Alphabets A- Z or a - z
2 Digits 0–9
3 Special + -*/ % . , : ;„ “| !\ ~ > < = ( ) { }[] #
Characters &^_ ?
2 Identifiers
An identifier is nothing but the name that is used for naming the
variables, Objects etc. In VB.NET, the identifier must begin with either a
letter or underscore ('_'). If an identifier begins with an underscore, it
must contain at least one other valid identifier character to
disambiguate it from a line continuation. Regular identifiers may not
match keywords, but escaped identifiers can match with keywords. An
escaped identifier is an identifier delimited by square brackets. Escaped
identifiers follow the same rules as regular identifiers except that they
may match keywords and may not have type characters. Although
Visual Basic .NET is not case sensitive, the case of identifiers is
preserved when applications are compiled. When using Visual
Basic .NET components from case- sensitive languages, the caller must
use the appropriate case.
3 Keywords
Keywords are nothing but the words that have some pre-defined
meaning. We It is impossible to use these words as identifiers of a
program. In Visual Basic.Net the keywords are reserved and it is even
impossible to use then as name of subroutines. The Keywords in Visual
Basic.Net are shown below.
5 Declaring Variables
Before using a variable in the program, it must be declared. The
declaration of variable tells the compiler about the type of data to be
held by the variable and the memory to be reserved for it and to store
the initial value in it. Variables are normally declared in the general
section of the codes' windows using the Dim statement. Dim is a
keyword. Dim stands for Dimension. The format is as follows:
6 Variable initialization
Number1 = 100
Number2 =
Number1-45
Username = “AnandKumar”
Button1.Visible = True
Label4.Caption =
textbox1.Text Number3 = Val
(Textbox1..Text)
The New is a Keyword which is used to create the instance of the class.
Unlike value types, such as Integer and Double, objects are reference
types, and it should be created explicitly before using them in the
program. It is also possible to create an instance of the form as well as
all the controls. For example Button is control and the class for button is
Button. So the instance can be created in such a way as shown below
The Nothing keyword represents the default value of any data type.
Assigning Nothing to a variable sets it to the default value for its
declared type. If that type contains variable members, they are all set to
their default values. The following example uses the Nothing keyword
9. Scope of Variable
There are many different ways you can declare variables. Variables can
be declared with any one of the scope such as public, private, protected,
friend and protected friend. If the variable is declared as public then the
variable will be available anywhere in or outside of the project. If it is
declared as private then it is visible only within the block where it is
declared. When the variable is declared as protected then it can be used
in the class where defined and within any inherited class. When used
with friend it can only be accessed by code in the same
project/assembly. If the variable is declared as protected friend then it
has the combination of protected and friend.
10 Data Types
Before writing any program we have to decide the variables that are
going to be used in the program, the purpose of the variable and type of
data it should. Visual Basic classifies the information mentioned above
into two major data types such as numeric data types and the non-
numeric data types.
Numeric data types are types of data that consist of numbers, which can
be computed mathematically with various standard operators such as
addition, Subtraction, multiplication and division. Some of the examples
of numeric data types are height, weight, student marks, class strength,
monthly bills, fees etc. In Visual basic, numeric data are divided into 7
types, depending on the range of values they can store. Calculations that
only involve round figures or data that don't need precision can use
Integer or Long integer in the computation. Programs that require high
precision calculation need to use Single and Double decision data types,
they are also called floating point numbers. For currency calculation,
currency data types can be used. Lastly, if even more precision is
requires performing calculations that involve a many decimal points,
decimal data types can be used.
S.No Data Type Size Range of Values
1 Byte 1 byte 0 to 255
2 Integer 2 bytes -32,768 to 32,767
3 Long 4 bytes -2,147,483,648 to 2,147,483,648
4 -3.402823E+38 to -1.401298E-45 for negative
Single 4 bytes
values
1.401298E-45 to 3.402823E+38 for positive values.
5 -1.79769313486232e+308 to -
Double 8 bytes 4.94065645841247E-
324 for negative values 4.94065645841247E-324 to
1.79769313486232e+308 for positive values.
6 -922,337,203,685,477.5808 to
Currency 8 bytes 922,337,203,685,477.5807
7 +/- 79,228,162,514,264,337,593,543,950,335 if no
decimal is use +/-
Decimal 12 bytes
7.9228162514264337593543950335 (28
decimal
places).
1. Arithmetic Operators
2. Relational Operators
3. concatenation Operators
4. Bitwise Operators
5. Logical Operators
6. Unary Operators
1 Arithmetic Operators
2. Relational Operators
3 Concatenation Operators
Concatenation operators are used to concatenate multiple strings into a
single string. There are two concatenation operators available in visual
basic as shown in the table below.
5 Unary Operators
Operators that take one operand are called unary operators. VB.Net
provides the set of unary operators as shown the table below.
S.No Operator
s
1 Unary Plus (+)
2 Unary Minus(-)
3 Not (Logical)
4 AddressOf
The unary plus operator takes any numeric operand. It's not of much
practical use because the value of the operation is equal to the value of
the operand. The unary minus operator takes any numeric operand
(except as noted later). The value of the operation is the negative of the
value of the operand. In other words, the result is calculated by
subtracting the operand from zero. If the operand type is Short, Integer,
or Long, and the value of the operand is the maximum negative value for
that type, then applying the unary minus operator will cause a
ystem.OverflowException error, as in the following code fragment. The
logical negation operator takes a Boolean operand. The result is the
logical negation of the operand. That is, if the operand is False, the result
of the operation is true, and vice versa The AddressOf operator returns
a reference to a method. The Unary
Constants
If the value of the variable is not changed during the execution of the
program, then the variable is called as constant. For example, take a
students information of a class, student-name is a variable, because it
will changes to all the students. But the class-name is a constant and it
will not be changed for the particular class students. The syntax for
declaring constant is
Constants are different from variables in the sense that their values do
not change during the running of the program. The format to declare a
constant is
Example
Arrays
A variable is used to store the value which may be used for further
reference. In a simple variable only one value can be stored at a time So
how to store multiple values in the single variable?. The solution is
Arrays. Array is a collection of elements or data items All the elements
must be same data type and they are stored in consecutive memory
locations. It is a programming constructs that store data and allow user
to access them by numeric index or subscript. Arrays in Visual
Basic .NET inherit from the Array class in the System namespace. All
arrays in VB are zero based, meaning, the index of the first element is
zero and they are numbered sequentially. The user must specify the
number of array elements by indicating the upper limit or size of the
array. The upper limit is the number that specifies the index of the last
element of the array. Arrays are declared using Dim, ReDim, Static,
Private, Public and Protected keywords. An array can have one
dimension or more than one (multidimensional arrays). The
dimensionality of an array refers to the number of subscripts used to
identify an individual element. In Visual Basic the user can specify up to
32 dimensions. Arrays do not have fixed size in Visual Basic. The syntax
for declaring an array is
Array is created with name as student. Size of the array is five. First
name is stored in index of 0, second in 1 and so on. To retrieve the
elements from the array the index can be used as shown below.
MessageBox..Show(student(0))
When the statement is executed, message box will appear that displays
the first name from the array student. Instead of message box textbox
can be used to display the result with the following code
Program to store the student name in the array and to print the name in
message box.
"Anil" student(1) =
"Binoy"
student(2) = "Cheema"
student(3) = "Dhoni"
student(4) = "Farkhat"
MessageBox.Show(stude
nt(0))
End Sub
Dim Myarray(5) as
Integer ReDim
Myarray(10) as Integer
When the Redim statement is used to reinitialize the array, all the data
contained in the array will be lost. If the user wants to preserve existing
data when reinitializing an array then Preserve keyword should be used
as shown below.
a) Rectangular arrays
Rectangular arrays may be single-dimensional or multidimensional but
always have a rectangular shape. Rectangular means that the length of
each sub array in the same dimension is the same length. Array types
are reference types, so the declaration of an array variable merely sets
aside space for the reference to the array. Array instances are actually
created via array initializes and array creation expressions
Note: The elements of the array are not explicitly initialized. So all the
elements by default will be 0 of Integer type.
b) Jagged Arrays
Jagged Array is an array of arrays in which the length of each array can
differ. A Very good example for Jagged arrays is creating a table in which
the number of columns differ in each row. Say, if row1 has 3 columns,
row2 has 3 columns then row3 can have 4 columns, row4 can have 5
columns and so on. The following code demonstrates jagged arrays. It is
the another type of multidimensional array.
The Rtrim function trims the empty spaces of the right portion of the
phrase. The format is
Rtrim(“Phrase”)
.For
example,
Rtrim (“Visual Basic ”, 4) = Visual basic
(vi) The Trim function
The Ttrim function trims the empty spaces on both side of the phrase. The
format is
Trim(“Phrase”)
.For example,
Trim (“ Visual Basic ”) = Visual basic
(viii) The Mid Function
The Mid function extracts a substring from the original phrase or string.
It takes the following format:
Mid(phrase, position, n)
Where position is the starting position of the phrase from which the
extraction process will start and n is the number of characters to be
extracted. For example,
Mid(“Visual Basic”, 3, 6) = ual Bas
(ix) The InStr function
The InStr function looks for a phrase that is embedded within the
original phrase and returns the starting position of the embedded
phrase. The format is
Instr (n, original phase, embedded phrase)
Where n is the position where the Instr function will begin to look for
the embedded phrase. For example
Instr(1, “Visual Basic”,” Basic”)=8
(x) The Ucase and the Lcase functions
The Str is the function that converts a number to a string while the Val
function converts a string to a number. The two functions are important
when we need to perform mathematical operations.
(xii) The Chr and the Asc functions
If you want terminate a function procedure early, you can use the "Exit"
statement:
MsgBox() Function
Msgbox () function displays a message in a dialog box, waits for the user
to click a button, and returns an Integer indicating which button is
clicked by the user. Its syntax is MsgBox(prompt [, buttons] [, title])
Example
Private Sub OK_Click()
End Sub
When a user click the OK button, the input box as shown in Figure 10.5
will appear. After user entering the message and click OK, the message
will be displayed on the caption, if he click Cancel, "No message" will be
displayed.
Controlling Structures
If Then Statement
This is the simplest control structure which asks the computer to
perform a certain action specified by the VB expression if the condition
is true. However, when the condition is false, no action will be
performed. The general format for the if...then.. Statement is
If condition
Then
Statements
End If
Program to check whether the given number is greater than 50 or
not
Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim number1 As
Integer number1 =
TextBox1.Text If
number1 > 50 Then
Msgbox” The number is greater than
50” End If
End
Sub
End
Sub
This program displays the message box if the condition is satisfied. If the
user enters the number smaller then 50 then the user will not receive
any output. This indicates that if only the condition is satisfied then the
statement will be executed. It is the drawback of simple If statement.
If....Then...Else Statement
If condition
Then
Statement
(1)
Else
Statement
(2) End If
In the previous program, when user inputs the value smaller than 50
then no output will be displayed. But in this program, even if the input is
smaller than 50 the message box will be displayed as “The number is
smaller than 50”. This is possible only with the use If Then else
statement.
If....Then...Else If Statement
If there are more than two alternative choices, using jus If....Then. Else
statement will
not be enough. In order to provide more choices, we can use the If....Then.
ElseIf
Statement. The general format for the if...then.. Else
statement is If condition Then
Statement (1)
ElseIf condition
Then
Statement
(2) ElseIf
condition Then
Statement (3).
.
.
.
Else
Statement (n)
End If
Select Case
mark Case
Is >= 85
Textbox1.Text= "Excellence
It is possible to use Select Case statement with numbers, as well, and the
To word comes in very handy here. If you were checking a variable to
see if the number that was in the variable fell within a certain range, you
could use something like this:
Select Case
mark Case 0
to 40
Textbox1.Text = "Fail"
Here, a variable called mark is being tested. It's being checked to see if it
falls between certain values. If it does, then a message box is displayed.
Looping Structures
The simple statements that had discussed in the previous section are
used to execute the statements only once. If suppose a programmer
needs to execute the same statements multiple times. Then some other
statement should be used. The solution for this is a looping statement. .
For example, to print the string “Visual basic” five times. The same
statement should be used five times in the coding. But, imagine if the no.
of time increases to print 1000 times or N times. By using the looping
statements a statement or set of statements can be executed repeatedly.
Visual Basic 2010 allows a procedure to be repeated as many
times as long as the processor and memory could support. This is
generally called looping. In Visual Basic 2010, different looping
statements are available such as Do Loop, For Loops etc.
Do Looping Statements
Looping is a very useful feature of Visual Basic because it makes repetitive
works easier.
Do Loop statements provide a way to continue iterating while one
or more conditions are true? Many types of Do Loops exists in
Visual Basic.Net such as
1. Do…While Statement
2. Do…Loop While Statement
3. Do…Until Statement
4. Do…Loop Until
Do while condition
Block of one or more
statements Loop
This program prints the numbers from 1 to 100 in the textbox. Once it
reach 100, the loop terminates.
Do Until Statement
Another format of Do Loops is Do ... Until statement. There is no much
difference between the two looping statements. The format is given
below
Do Until condition
Block of one or more
statements Loop
End Sub
Do
MsgBox number
number = number + 1
Loop Until number >=
5 End Sub
For…Next Statement
The For loop executes a block of statements a specified number of times.
The number of iterations is controlled by a loop variable, which is
initialized to a certain value by the For statement, then is incremented
for each iteration of the loop. The statements in the body of the loop are
repeatedly executed until the loop variable exceeds a given upper
bound.
For variable = expression To expression [ Step
expression ] Statements
Next [ variable_list ]
The loop variable can be of any numeric type. The variable is set
equal to the value of the first expression before entering the first
iteration of the loop body. Prior to executing each iteration of the loop,
the loop variable is compared with the value of the second expression. If
the value of the loop variable is greater than the expression (or less than
the expression if the step expression is negative), the loop exits and
execution continues with the first statement following the Next
statement
The step expression is a numeric value that is added to the loop
variable between loop iterations. If the Step clause is omitted, the step
expression is taken to be 1. The Next statement marks the end of the
loop body. The Next keyword can either appear by itself in the
statement or be followed by the name of the loop variable. If For
statements are nested, a single Next statement can terminate the bodies
of multiple loops. For example:
Dim i as
Integer For
i=1 to 10
Msgbox i
Next
End Sub
This program will print the numbers from 1 to 10 in the message box.
For…Each…Next Statement
The For Each statement is similar to the For statement, except that the
loop variable need not be numeric, and successive iterations do not
increment the loop variable. Instead, the loop variable takes successive
values from a collection of values. Here is the syntax
For Each variable In
expression Statements
Next [ variable ]
Part –B (2 Marks)
1. What is variable? What are the rule to be followed to define the variable.
2. What is Operator? List out its types.
3. Define Array. List out its types.
4. Write a note on message box. Give the example
5. Differentiate Entry control loop and Exit control loop.
6. Differentiate Message Box and Input Box.
Part –C (6 Marks)
1. Explain the different data types with example
2. Explain different operators in Vb.Net with example
3. What is an array? Explain its types
4. Explain message and input box with example
5. Explain different control flow statements by giving example
DEPARTMENT OF COMPUTER
TECHNOLOGY
REG.NO :
CLASS : II -
BSC IT
SEMESTER : IV
SUBJECT : MULTIMEDIA AND ITS APPLICATION
CODE : 18ITU514B
JULY 20 – DEC 20
KARPAGAM ACADEMY OF HIGHER EDUCATION
(Deemed to be university)
(Established Under section 3 of UGC Act 1956)
COIMBATORE-641021
DEPARTMENT OF COMPUTER
TECHNOLOGY CERTIFICATE
This is to certify
that this is a bona-fide record work done by
doing III- B.Sc. Information
Technology for the Practical Examination
in MULTIMEDIA AND ITS APPLICATIONS–
PRACTICAL held on
7. 23.11.2020
Bouncing Ball
AIM :
ALGORITHM :
STEP 2 : Select Canvas->properties and click Time and Change End time as 2s
and close the dialog box.
STEP 3 : Drag a shape into the window keeping the time as 0f.
RESULT:
The above program has been executed successfully and the output is
verified.
Ex.No:2
AIM :
ALGORITHM :
STEP 1 : For unnatural and gloomy effect use cartoon filter (filter-Artistic-
cartoon).
STEP 2 : Add a new layer make it transparent fill the transparent layer with
random noise (filter-noise-Hurl Make sure randomize is checked) make it
gray scale, use layer-colors, Desaturate).
STEP 4 : Change the layer mode for the noise layer to screen and adjust its
color levels as shown (tools>color tools > levels to 109)
STEP 5 : Duplicate the base photo and for each duplicate repeat the previous
steps by adding a transparent layer, fill it with noise apply between and
motion blur desaturate, change the mode to screen, adjust levels
STEP 6 : Merge down the noise layer to their photo background to get the
final frames in the animation.
OUTPUT :
DATE:24.09.2020 SUBTRACTING THE SHAPE
AIM :
ALGORITHM :
STEP 3 : Drag the rectangle and circle shape into the screen.
STEP 5 : change the circle outline’s blend method as into and change width as
3p
OUTPUT :
DATE:19.10.2020 DREAMY EFFECT
AIM :
ALGORITHM :
STEP 1 : Open an image and create a new layer and change the name as mono.
STEP 2 : Place the original picture at the top and the mono layer at the
bottom.
STEP 4 : Select mono layer and select Filter>blur>Gaussian blur and change
horizontal as 15 and vertical as 15.
STEP 6 : Select mono layer and goto color>colorize and change the value of
hue to 253.
STEP 7: Click the original picture layer and create a duplicate layer. Repeat
steps from 3 to 9.
STEP 8 : Click the original layer and create a duplicate layer.Repeat steps from
3 to 8.
RESULT:
STEP 9: Merge down the mono layers to get the final effects of animation.
The above program has been executed successfully and the
STEP 10 : Preview the end result (filters>animation>playback).
output is verified.
STEP 11 : Click play button.
Ex.No:5
OUTPUT :
DATE:22.10.2020 FRACTAL EFFECT
AIM :
ALGORITHM :
STEP 3 : Select filters menu and then select render >nature>IFS fractal.
RESULT:
OUTPUT :
DATE:02.11.2020 TRANSPARENT GLASS LETTERING
AIM :
ALGORITHM :
OUTPUT :
DATE:23.11.2020 BOUNCING BALL
AIM :
ALGORITHM :
STEP 4 : Using a move tool move the circle through the rectangle.
RESULT:
AIM:
ALGORITHM:
STEP 4: Click filters menu and click the Blur -> Gaussian Blur and change
horizontal and vertical as 35
STEP 5: Click the filters menu and choose distorts-> Iwarp and change to
smoky effect, swirl CCW, move-> shrink.
RESULT:
OUTPUT :
DATE:10.12.2020 TEXT PORTRAIT
AIM:
ALGORITHM:
STEP 2: click open in the file menu and place the image.
STEP 4: Select the duplicate layer. In that choose the edit option and fill with
FG color.
STEP 5: Graph the text tool. click it on the screen and change the text color as
white.
STEP 6: select the text layer and right click on it. Add layer mask with full
opacity.
STEP 7: copy the last layer and select the text layer in the small white box and
paste the layer.
STEP 8: Right click on the floating selecting layer and choose the Anchor
layer.
STEP 9: Select the text layer and choose the rectangular select tool and click
the text , goto edit and fill with FG color.
RESULT:
STEP 10: Choose levels in the colorstool and change the input levels 11, 1, 29,
213. The above program has been executed successfully and the
output is verified.
RESULT:
OUTPUT :
DATE:11.12.2020 BOKEH EFFECT
AIM:
ALGORITHM:
STEP 2: click new in the file menu. change the FG color as Black and click the
bucket tool and fill it on the screen.
STEP 3:Click the ellipse tool and create a new layer and name it as Bokeh.
Draw the ellipse and fill it with white color.
STEP 4: create a duplicate layer in the layer menu. Click the Bokeh layer and
right click on the ellipse and choose clear in the edit option.
STEP 6: click ellipse tool and select merge down in the layer menu.
STEP 7: create a new layer and drag with ellipse tool and fill it with white
color.
STEP 8: Select alpha to selection in the transparency in the layer menu and
select shrink as 1 px.
STEP 9: create a duplicate layer in the layer menu. Click the bokeh 1 layer and
click the ellipse in the screen and right click on it and choose clear in the edit
option.
STEP 10: click the merge down in the layer menu. Click the bokeh layer .
Choose Gaussian blur in blur and change the horizontal and vertical as 40
STEP 11: click the bokeh layer and create a duplicate layer and drag the
ellipse.
STEP 12: Click the 1st duplicate layer and create the another duplicate layer
and drag the ellipse.
STEP 13: Click the 2nd duplicate layer and create the another duplicate layer
and drag the ellipse.
STEP 14: : Click the 3rd duplicate layer and create the another duplicate layer
and drag the ellipse
STEP 15: : Click the 4th duplicate layer and create the another duplicate layer
and drag the ellipse
STEP 16: click the gradient tool and go to mergedown in the layer menu upto
background layer.
STEP 17: Double click the gradient tool and fill saturation spectrum and
change the mode as overlay.
STEP 18: Using Gradient tool, drag the screen as half rectangle.
OUTPUT :
RESULT: