7. Replace
O Dim sText, vbClf, vbCr, vbLf As String
O Dim strArray(20) As String
O vbClf = "Pillow"
O vbCr = "Trimow"
O vbLf = ""
O sText = TextBox1.Text
O 'replace different new line characters with one version
O sText = sText.Replace(vbCrLf, vbCr)
O 'remove last carriage return if it exists
O If sText.EndsWith(vbCr) Then
O sText = sText.Substring(0, sText.Length - 1)
O TextBox2.Text = sText
O End If
10/1/2016 7
23. Controls Collection
O In Visual Studio terminology, the entire set
of objects on a form is called the Controls
collection.
O The Controls collection is created
automatically when we open a new form,
and when we add objects to the form, they
become part of that collection.
10/1/2016 23
24. Collection
Each collection in a program has its own
name so that you can reference it as a
distinct unit in the program code.
10/1/2016 24
25. Collection
O The Controls name to reference the
collection of objects on a form.
O This grouping method is similar to the way
arrays group a list of elements together
under one name, and like Visual Basic
arrays, the Controls collection is zero-
based.
10/1/2016 25
26. Collection
We can reference the objects in a collection,
or the individual members of the collection,
by specifying the index position of the object
in the group.
10/1/2016 26
27. Collection Objects
Visual Basic stores collection objects in the
reverse order of that in which they were
created, so you can use an object’s “birth
order” to reference the object individually, or
you can use a loop to step through several
objects.
10/1/2016 27
32. Assembly
O When an application is compiled, the
output of the compilation produces what is
known as an Assembly.
10/1/2016 32
33. Types of Executable
Two types of Executable
O Dynamic link library file(*.dll)
O Executable(*.exe)
10/1/2016 33
34. Assembly
The assembly is the unit of deployment in
Microsoft .NET and it can be thought of as a
collection of types and resources that form a
logical unit of functionality.
10/1/2016 34
35. Private Assemblies
A private assembly is an assembly that is
deployed with an application and is
available only for that application.
That is, other applications do not share the
private assembly. Private assemblies are
installed in a folder of the application's
directory structure.
10/1/2016 35
37. Self Describing
An assembly is a self-describing entity. It
contains all information about the types
(classes) contained in the assembly, all
external references needed for executing
the assembly and so on.
10/1/2016 37
38. Manifest
The manifest contains assembly’s identity
and version information, a file table
containing all files that make up the
assembly and the assembly reference list
for all external dependencies.
Thus, assemblies do not need to depend on
the registry values for compilation or
execution.
10/1/2016 38
39. Manifest Data
An assembly contains manifest data and
one or more modules. Manifest data
contains information about the assembly
and other list of assemblies that it depends
on.
It also contains all the publicly exposed
types and resources. An assembly contains
various modules. Each module contains
metadata and IL.
10/1/2016 39
40. Assembly Type
Assemblies can be single file assemblies or
multi file assemblies.
In multi file assemblies one of the files must
contain the assembly’s manifest data.
Multi file assemblies can have only one
entry point even though the assembly can
contain multiple code modules.
10/1/2016 40
41. Multi File Assembly
A multi file assembly is created primarily for
combining modules written in different
programming languages.
Once the assembly is created, the file that
contains the assembly manifest (and hence
the assembly) can be signed, or one can
give the file (and the assembly) a strong
name and put it in the global assembly
cache.
10/1/2016 41
42. Use of Multi File Assembly
Main uses of multi file assembly are for
combining modules written in different
programming languages.
They enable optimization of downloading an
application by putting seldom-used types in
a module that is downloaded only when
needed.
10/1/2016 42
43. Private Assemblies
A private assembly is an assembly that is
deployed with an application and is
available only for that application.
That is, other applications do not share the
private assembly.
Private assemblies are installed in a folder
of the application's directory structure.
Typically, this is the folder containing the
application's executable file.
10/1/2016 43
44. Shared Assemblies
A shared assembly is an assembly available for
use by multiple applications on the computer.
To make the assembly global, it has to be put
into the Global Assembly Cache.
Each computer where the common language
runtime is installed has a machine-wide code
cache called the global assembly cache.
The global assembly cache stores assemblies
specifically for sharing by several applications
on the computer.
10/1/2016 44
45. Global Assembly Cache
This is achieved with the help of a global
assembly cache tool (gacutil.exe) provided
by the .NET Framework.
One can also drag & drop the assemblies
into the Global Assembly Cache directory.
10/1/2016 45
46. Strong Name
O A strong name contains the assembly's
identity i.e. it’s text name, version number,
and culture information strengthened by a
public key and a digital signature
generated over the assembly.
O This is because the CLR verifies the
strong name signature when the assembly
is placed in the Global Assembly Cache.
10/1/2016 46
47. Application Domains And
Assemblies
O Before an assembly can be executed, it must be
loaded into an application domain.
O By default, the CLR loads an assembly into an
application domain containing the code that
references it.
O An assembly is not shared between domains when
it is granted a different set of permissions in each
domain.
O This can occur if the runtime host sets an
application domain-level security policy.
O Assemblies should not be loaded as domain
neutral.
O If the set of permissions granted to the assembly is
to be different in each domain.
10/1/2016 47
61. References
O dotNET Tutorial for Beginners, India
Community Initiative
O Microsoft Visual Studio 2010 by Michael
Halvorson, Microsoft
O Microsoft Visual Basic 6.0 by Francesco
Balena ,Microsoft
10/1/2016 61