Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

VB.

net
What is VB.net
VB.NET is an update to Visual Basic that targets Microsofts .NET Framework.
VB.NET has a lot of similarities to Visual Basic but also some differences. VB.NET is
an object-oriented language, which supports the abstraction, encapsulation,
inheritance, and polymorphism features. It is the most productive tool for rapidly
creating a wide range of Windows, Web, Mobile, and Office applications built on
the .NET Framework.
The Visual Basic language is designed to be human readable and accessible to
everyone from novice programmers to advanced system architects. All of this is
built on top of the .NET Framework, which guarantees that programs written in
Visual Basic run with unsurpassed scalability and reliability. The .NET Framework
provides VB.Net programmers with the ability to create fully object oriented
programs (OOPs), just like the ones created using Java, C# or C++. Also programs
written in VB.Net will interoperate seamlessly with programs written in any other
.NET languages such as Visual C#, Visual J#, or Visual C++.
Many programmers says VB.Nets ease of use as the key to its success.
Using VB.NET, you can create a wide variety of applications, such as a
Console Applications, that displays its output in an MS-DOS-like
window, Windows Applications that often displays a form-based
interface, Web Applications, Web Services, Mobile Applications etc. I
hope this site will help you to acquire the skills and knowledge
necessary to develop various types of applications in VB.NET in a
simplified manner rather than in a complex way.
Visual Studio IDE

• Visual Studio is a powerful and customizable programming


environment that contains all the tools you need to build programs
quickly and efficiently. It offers a set of tools that help you write and
modify the code for your programs, and also detect and correct errors
in your programs.
• Before you start learning more about VB.NET programming, it is
important to understand the development environment and identify
some of the frequently using programming tools in Visual Studio IDE
1. Menu Bar
2. Standard Toolbar
3. ToolBox
4. Forms Designer
5. Output Window
6. Solution Explorer
7. Properties Window
• Visual Basic.NET IDE is built out of a collection of different windows.
Some windows are used for writing code, some for designing
interfaces, and others for getting a general overview of files or classes
in your application.
• Visual Studio organizes your work in projects and solutions. A solution
can contain more than one project, such as a DLL and an executable
that references that DLL. From the following chapters you will learn
how to use these Visual Studio features for your programming needs.
Windows Forms
• VB.Net programmers
have made extensive use
of forms to build user
interfaces. Each time you
create a Windows
application, Visual Studio
will display a default
blank form, onto which
you can drag and drop
controls from the Visual
Studio Toolbox window.
• The first step is to start a new
project and build a form. Open
your Visual Studio and select
File->NewProject and select
Visual Basic from the New Select project type from New project dialog Box
project dialog box and select
Windows Froms Application.
Enter your project name
instead of
WindowsApplication1 in the
bottom of dialog box and click
OK button. The following
picture shows how to crate a
new Form in Visual Studio.
• When you add a Windows
Form to your project, many
of the forms properties are
set by default. Although
these values are
convenient, they will not
always suit your
programming needs. The
following picture shows
how is the default Form
look like.
Label Control
• Microsoft Visual Studio .NET controls
are the graphical tools you use to
build the user interface of a VB.Net
program. Labels are one of the most
frequently used Visual Basic control.
• A Label control lets you place
descriptive text , where the text does
not need to be changed by the user.
The Label class is defined in the
System.Windows.Forms namespace.
VB.NET Data Types
• DATATYPE in a programming language describes that what type of data a
variable can hold . When we declare a variable, we have to tell the
compiler about what type of the data the variable can hold or which data
type the variable belongs to.
• Syntax : Dim VariableName as DataType
• VariableName : the variable we declare for hold the values.
• DataType : The type of data that the variable can hold
• VB.NET sample :
• Dim count As Integer
• count : is the variable name
• Integer : is the data type
• In the variable count we can hold the integer values in
• the range of -2,147,483,648 to +2,147,483,647.
• The following are the some of commonly using datatypes in vb.net.
• Boolean
• Boolean variables are stored 16 bit numbers and it can hold only True
or false.
• Integer
• Integer variables are stored sighned 32 bit integer values in the range
of -2,147,483,648 to +2,147,483,647
• VB.NET Runtime type : System.Int32
• VB.NET declaration : dim count as Integer
• VB.NET Initialization : count = 100
• VB.NET default initialization value : 0
• String
• String variables are stored any number of alphabetic, numerical, and
special characters . Its range from 0 to approximately 2 billion
Unicode characters.
• VB.NET Runtime type : System.String
• VB.NET declaration : Dim str As String
• VB.NET Initialization : str = "String Test"
• VB.NET default initialization value : Nothing
How to use IF ELSE in VB.NET
• The conditional
statement IF ELSE , is use If [your condition here]
Your code here Else Your
code Here End If
for examining the
conditions that we
provided, and making
decision based on that
condition. The conditional
statement examining the
data using comparison
operators as well as logical
operators.
How to use FOR NEXT loop in vb.net
• Whenever you face a situation in
programming to repeat a task for
several times (more than one The FOR NEXT Loop , execute the
times ) or you have to repeat a loop body (the source code within
For ..Next code block) to a fixed
task till you reach a condition, in number of times.
these situations you can use loop
statements to achieve your desired
results. This kind of for loop is
useful for iterating over arrays and
for other applications in which you
know in advance how many times
you want the loop to iterate.

You might also like