0% found this document useful (0 votes)
2 views

lecture 1

The document provides an overview of Visual Basic .NET (VB.NET), describing it as an object-based, event-driven programming language used for developing applications in Windows environments. It covers the components of VB.NET, including user interface design, event-driven programming, and the .NET framework, which supports various application types and includes a vast class library. Additionally, it discusses namespaces, file extensions, and the differences between debug and release versions of applications.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

lecture 1

The document provides an overview of Visual Basic .NET (VB.NET), describing it as an object-based, event-driven programming language used for developing applications in Windows environments. It covers the components of VB.NET, including user interface design, event-driven programming, and the .NET framework, which supports various application types and includes a vast class library. Additionally, it discusses namespaces, file extensions, and the differences between debug and release versions of applications.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 43

WELL COME TO VB .

NET

Instructor name: Getachew E.

Thursday, March 21,


2019

1
What is Visual Basic?

◦ Visual Basic is an Object-Based and


Event driven Programming language
for developing applications that run
under any of the MS Windows
environment i.e. GUI environment.
◦ It has two major components
 Collection of built-in objects called controls
(Command button, text box, Menus, dialog
box.. etc)
 A complete set of program commands

2
Cont’d
The overall approach to VB
programming is two fold
 Creating user interface
appropriate for the specific
application
 Adding instructions to carry out
the actions associated with
controls

3
Procedural, Object oriented
and Event driven programming
Procedural Language

The program specifies the sequence of all operations step-by-


step. The program logic determines the order of the instruction
to be executed. Ex. C, Basic, Cobol, Fortran. Etc

Object Oriented Language

The whole system is viewed developed as collection of objects.


An Object is a real world entity, which has distinguishable
property from other Objects. Ex. person, account, table, form,
text box, label.. etc
Properties are the attributes or nature of the Object, such as
name, color, size.. etc.
Methods are actions associated with objects. Ex. move, resize,
print, read, clear etc.
Example for Object Oriented Language is C++, VB.Net, and Java.
4
Event Driven Programming language

The programs do not follow sequential


logic, instead, the user can press keys
and click on various buttons and boxes
in a window.
Each user action can cause an Event to
occur, which triggers a procedure that
programmer have written.
Microsoft refers to visual basic (VB) as
an event-driven programming language
which has many (but not all) elements
of an object-oriented language such as
Java 5
Event and Event Procedure

An Event is the program’s response to


an action taken by the user. When
user takes action an event is occurred,
which enables the appropriate
procedure to be executed.
Ex. Command button click is one event.
The Event Procedure is the group of
commands or instructions to be
executed when some event occurs.
Ex. Set of actions to be carried over
when the command button is clicked
6
Developing VB projects

To develop VB projects, a three step process for


planning the project and then repeat the
process for creating the project is to be done.
Planning
 Design the User Interface : Draw the forms
and controls with the names
 Plan the Properties : The specify the
properties of all controls to set or change during
the design of the form
 Plan the basic code: Plan the procedures to
be executed when the project runs. Write the
pseudocode, which is an English expression or
comment describes the action.
7
Programming
Define the User Interface :
Create the forms and controls
designed in the planning stage
Set the Properties : Define the
properties of the controls
Write the Visual Basic code:
Write VB programming
statements to carry out the
actions needed.
8
VB.NET
 Used to create different application such as:
 windows application(web forms, such applications are usually local to
your machine)
Web application(Web forms, that come to you across the Internet),
Console application(that run in a DOS window)
 Console applications are command-line oriented
applications that run in DOS windows
 These three application types have user
interfaces
 There's also an additional new type of
application—one that doesn't have a built-in
user interface: Web services.
 Web services are applications that run on Web
servers and that communicate with other
programs. 9
Continued
All aspects of object-oriented programming
(OOP) have been implemented in VB .NET
including inheritance and polymorphism.
Inheritance—Inheritance is the process by
which you can derive new classes from
other classes.
Polymorphism—it is the ability to create
procedures that can operate on objects of
different types
Like Java, VB .NET does not support
multiple inheritances, but it does support
interfaces.
10
The .NET Framework
VB .NET is only one component of a
revolution in Windows-the .NET framework.
 This framework provides the new support for
software development and operating system
support in Windows, and it's more extensive
than anything we've seen in Windows before.
The .NET framework wraps the operating
system with its own code, and your VB .NET
programs actually deal with .NET code
instead of dealing with the operating system
itself.
And it is specially designed to make working
with the Internet easy.
11
Common Language Runtime
The base(#1) of the .NET framework
The CLR is the module that actually
runs your VB .NET applications.
When you create a VB .NET
application, what really happens is
that your code is compiled into the
CLR's Intermediate Language
(named MSIL, or IL for short), much
like byte codes in Java.

12
Continued
When you run the application, that IL code
is translated into the binary code your
computer can understand by some special
compilers built into the CLR.
 Compilers translate your code into
something that your machine's hardware,
or other software, can deal with directly. In
this way, Microsoft can one day create a
CLR for operating systems other than
Windows, and
 your VB .NET applications, compiled into
IL, will run on them.
13
The .NET Framework class library
 is the second major part of the .NET framework.
 The class library holds an immense amount of
prewritten code that all the applications you create
with Visual Basic, Visual C++, C#, and other Visual
Studio languages build on.
 The class library gives your program the support it
needs-for example, your program may create several
forms, and as there is a class for forms in the class
library, your program doesn't have to perform all the
details of creating those forms from scratch.
 All your code has to do is declare a new form, and
the CLR compilers can get the actual code that
supports forms from the .NET Framework class
library.
 In this way, your programs can be very small
compared to earlier Windows applications; because
you can rely on the millions of lines of code already
written in the class library, not everything has to be 14
continued
The code for all elements we use in a
VB .NET application-forms, buttons,
menus, and all the rest-all comes from the
class library.
Other Visual Studio applications use the
same class library, making it easy to mix
languages in your programming, even in
the same application.
 Distributing applications is easier,
because all the support you need is
already on the machine you're installing
your application to.
15
Namespaces
.NET framework organizes its
classes into namespaces.
For example, the .NET framework
includes the namespaces
Microsoft.VisualBasic,
Microsoft.JScript,
Microsoft.CSharp, and
Microsoft.Win32.

16
Continued
In fact, these namespaces
contain relatively few classes
 Real way we'll interact with
the .NET framework class library
in this course is through the
System namespace

17
System Namespaces
 You can't build a VB .NET application without
using classes from the .NET System
namespace, as we'll see over and over again
in this course.
 When you want to use a Windows form, for
example, you must use the
System.Windows.Forms. Form class. A
button in a Windows form comes from the
System.Windows. Forms.Button class, and
so on. There are many such classes, organized
into various namespaces like
System.Windows.Forms. Here's an
overview of some of those namespaces:
18
Continued
A button in a Windows form
comes from the
System.Windows.
Forms.Button class
and so on.
There are many such classes,
organized into various
namespaces like
System.Windows.Forms.

19
Here's an overview of some of
those namespaces
 System-Includes essential classes and base
classes that define commonly used data
types, events and event handlers, interfaces,
attributes, exceptions, and so on.
 System.Collections-Includes interfaces and
classes that define various collections of
objects, including such collections as lists,
queues, arrays, hash tables, and dictionaries.
 System.Data-Includes classes that make up
ADO.NET. ADO.NET lets you build data-
handling components that manage data from
multiple distributed data sources. 20
Continued
System.Data.OleDb-Includes classes
that support the OLE DB .NET data
provider.
System.Data.SqlClient-Includes classes
that support the SQL Server .NET data
provider.
System.Diagnostics-Includes classes
that allow you to debug your application
and to step through your code. Also
includes code to start system processes,
read and write to event logs, and monitor
system performance.
21
Continued
System.Drawing-Provides
access to the GDI+ graphics
packages that give you access to
drawing methods.
System.Drawing.Drawing2D-
Includes classes that support
advanced two-dimensional and
vector graphics.
System.Drawing.Imaging-
Includes classes that support
22
Continued
 System.Drawing.Printing-Includes classes
that allow you to customize and perform
printing.
 System.Drawing.Text-Includes classes that
support advanced GDI+ typography operations.
The classes in this namespace allow users to
create and use collections of fonts.
 System.Globalization-Includes classes that
specify culture-related information, including
the language, the country/region, calendars, the
format patterns for dates, currency and
numbers, the sort order for strings, and so on.

23
Continued
System.IO-Includes types that support
synchronous and asynchronous reading
from and writing to both data streams and
files.
System.Net-Provides an interface to many
of the protocols used on the Internet.
System.Net.Sockets-Includes classes
that support the Windows Sockets
interface. If you've worked with the
Winsock API, you should be able to develop
applications using the Socket class.

24
Continued
System.Reflection-Includes classes
and interfaces that return information
about types, methods, and fields, and
also have the ability to dynamically
create and invoke types.
System.Security-Includes classes that
support the structure of the common
language runtime security system.
System.Threading-Includes classes
and interfaces that enable
multithreaded programming.
25
Continued
 System.Web-Includes classes and interfaces
that support browser/server communication.
Included in this namespace are the
HTTPRequest class that provides information
about HTTP requests, the HTTPResponse
class that manages HTTP output to the client,
and the HTTPServerUtility class that
provides access to server-side utilities and
processes. You can also use cookies, support
file transfer, and more with these classes.
System.Web.Security-Includes classes that
are used to implement ASP.NET security in
Web server applications. 26
Continued
System.Web.Services-Includes classes
that let you build and use Web services,
programmable entities on Web Server that
code can communicate with using
standard Internet protocols.
System.Windows.Forms-Includes
classes for creating Windows-based forms
that make use of the user interface
controls and other features available in
the Windows operating system.
System.Xml-Includes classes that
support processing of XML
27
File Extensions Used in VB .NET

When you save a solution, it's given the file


extension .sln
All the projects in the solution are saved with
the extension .vbproj.
Here's a list of the types of file extensions
you'll see in files in VB .NET, and the kinds of
files they correspond to; the most popular
file extension is .vb.
This is a useful list, because if VB .NET has
added files to your solution that you haven't
expected, you often can figure them out by
their file extension: 28
Continued
vb-Can be a basic Windows form, a code
file, a module file for storing functions, a
user control, a data form, a custom
control, an inherited form, a Web custom
control, an inherited user control, a
Windows service, a custom setup file, an
image file for creating a custom icon, or
an AssemblyInfo file (used to store
assembly information such as versioning
and assembly name).
.xsd-An XML schema provided to create
typed datasets.
29
Continued
xml-An XML document file.
.htm-An HTML document.
.txt-A text file.
.xslt-An XSLT stylesheet file, used
to transform XML documents and
XML schemas.
.css-A cascading stylesheet file.
.rpt-A Crystal Report.
.bmp-A bitmap file.
30
Continued
 js-AJScript file (Microsoft's version of JavaScript).
 .vbs-A VBScript file.
 .wsf-A Windows scripting file.
 .aspx-A Web form.
 .asp-An active server page.
 .asmx-A Web service class.
 .vsdisco-A dynamic discovery project; .vsdisco
provides a means to enumerate all Web Services
and all schemas in a Web project.
 .web-A Web configuration file, .web configures
Web settings for a Web project.
 .asax-A global application class, used to handle
global ASP.NET application-level events.
 .resx-A resource file used to store resource
31
Debug and Release Versions
In a debug version of your program, Visual
Basic stores a great deal of data needed to
interface with the debugger in your program
when it runs
This not only makes the corresponding
assembly larger, but also slower.
 In the release version of your program, the
program doesn't have all that added data,
and can run as a stand-alone program,
without needing to be launched from Visual
Basic (although it still needs the .NET
Framework, of course).

32
Switching debug to
release
When you create a new solution,
Visual Basic creates it in debug
mode, meaning that you launch it
from the Debug menu as we've
been doing.
However, you can switch to
release mode in several ways
(like many things in VB .NET,
there's more than one way to do
it)
33
Ways to switch debug to
release
Select the Configuration Manager item in
the Build menu, then select Release in the
Active Solution Configuration list box and
click OK.
Select the solution you want to set the
mode for by clicking it in the Solution
Explorer, and find its Active Config
property in the properties window. When
you click the right-hand column in the
properties window next to this property, a
drop-down list box will appear; select
Release in that list box.
34
Continued
Select the solution you want to set the mode for by
clicking it in the Solution Explorer, and select the
Properties item in the Project menu, opening the
solution's property pages. Select the Configuration
Properties folder in the box at left, and the
Configuration item in that folder. Then select Release
from the drop-down list box in the configuration
column of the table that appears, and click OK.
Probably the easiest way to set the solution mode to
release or debug is simply to use the drop-down list
box that appears in the Visual Basic .NET standard
toolbar, at the top of the IDE. When you create a
new solution or project, this list box displays the
word Debug, and all you need to do to switch to
release mode is to select Release instead.
35
Building release
When you've set the mode for a solution
to Release, you build it using the Build
menu's Build item (the Build menu item
causes Visual Basic to compile only items
it thinks have been newly changed; to
force it to compile all items in the
solution, choose the Rebuild All item
instead of Build).
This builds the solution in a way that
others can use it, and you can deploy
your program this way
36
Visual Basic Integrated Development
Environment

37
Continued
There are so many independent windows in
the IDE that it's easy to misplace or rearrange
them inadvertently.
The IDE windows are docking windows, which
means you can use the mouse to move
windows around as you like
when the windows are near an edge, they'll
"dock"-adhere-to that edge
 you can reconfigure the IDE windows as you
like. If you move IDE windows inadvertently,
don't panic; just use the mouse to move them
back.
38
Continued
windows in the IDE come with an X button
at upper left, which means you can close
them. I
don't know about you, but I sometimes click
these when I don't mean to, and a window I
wanted disappears.
It's easy to panic: The toolbox is gone! I'll
have to reinstall everything! In fact, all you
have to do is to find that window in the
View menu again (such as View|Toolbox) to
make it reappear.
39
Continued
There's so much packed into the IDE that
Microsoft has started to make windows share
space
you can keep them separate using tabs such
as those you can see above the form at the
center of Fig: 1. If you click the
Form1.vb[Design] tab, you see the form itself
as it'll appear when the program runs;
if you click the Form1.vb tab, you'll see the
form's code, and
if you click the Start Page tab, you'll see the
Start page, which lets you select from among
recent solutions to open. 40
Continued
VB .NET adds a new button in dock able IDE
windows-a little thumbtack button at upper
right as you see in various windows in Fig:
1 next to the X close button.
This is the "auto-hide" feature, which lets
you reduce a window to a tab connected to
the edge it's docked on.
If I let the mouse move over that tab, the
full Sever Explorer window will glide open,
covering most of the toolbox.
You can auto-hide most windows like this
To restore a window to stay-open status,
just click the thumbtack again. 41
Continued
you can customize the IDE as well.
For example, to customize IDE options
such as the fonts and colors used to
display code, you select the Tools|
Options menu item and use the various
items in the Environment folder.
To customize menus and toolbars, such
as specifying the toolbars to display
(How many are there to choose from?
Twenty-seven.), or what buttons go on
what toolbars, use the Tools|Customize
menu item.
42
Thank you!!!

43

You might also like