0% found this document useful (0 votes)
10 views12 pages

VB Notes1

Uploaded by

shamaatmika.uv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views12 pages

VB Notes1

Uploaded by

shamaatmika.uv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Chapter-2

What is Vb.net?
VB.Net is a simple, modern, object-oriented computer programming language developed by
Microsoft to combine the power of .NET Framework and the common language runtime with
the productivity benefits that are the advance of Visual Basic. Visualbasics is a language ..net
is a platform

Types of project in .Net


Window application
Web application-Web services are applications that run on Web servers and that
communicate with other programs
Console application-command-line oriented applications that run in DOS
Mobile application

Introduction to Visual Basic.Net IDE


 The Visual Basic Integrated Development Environment(IDE)
 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[Each window can be moved, resized, opened, closed, or
customized]
You'll see the Visual Basic Integrated Development Environment appear, as in Follows

The Start Page


We've already seen the Start page, which is what you see when you first start Visual Basic.
You can use the Start page to select from recent projects; by default, the Get Started item is
selected in the Start page at upper left. You can also create a new project here by clicking the
New Project button.

1 II BCA-III Sem/VB.net 1
Menu bar –Visual Basic and have seen the Start page, you often turn to the menu system to
proceed, as when you want to create a new project and use the File|New|Project menu item to
bring up the New Project dialog box
The IDE menu system is very involved, with many items to choose from-and you don't even
see it all at once.
The menu system changes as you make selections in the rest of the IDE-for example, the Project
menu will display 16 items if you first select a project in the Solution Explorer, but only 4 items
if you have selected a solution, not a project.
There are hundreds of menu items here, and many useful ones that will quickly become
favorites, such as File|New| and you can access from the Recent Files or Recent Projects items
near the bottom of the File menu.
it includes file, edit, view, project, build, debug, data, format, tools, window, and help menu
Toolbar - The toolbars feature is another handy aspect of the IDE. These appear near the top
of the IDE. Toolbars provide a quick way to select menu items, it includes many buttons as
shortcuts for frequently used operations. Each button represents a command that can be selected
from a menu. Most toolbars’ buttons are displayed in the main window of the IDE
Menu bar
Toolbar

The New Project Dialog Box


When you want to create a new project, you turn to the New Project dialog box.
In addition to letting you select from all the possible types of projects you can create in Visual
Basic, you can also set the name of the project, and its location; for Windows projects, the
location is a folder on disk, but for Web projects, you specify a server running IIS.

2 II BCA-III Sem/VB.net 2
Graphical Designers
When you're working on a project that has user interface elements-such as forms, VB .NET can
display what those elements will look like at run time, and, of course, that's what makes Visual
Basic visual
There are several different types of graphical designers, including:
 Windows form designers
 Web form designers
 Component designers
 XML designers

Code Designers
code designers let you edit the code for a component, and you can see a code.You can use the
tabs at the top center of the IDE to switch between graphical designers.can also switch between
graphical and code designers using the Designer and Code items in the View menu, or you can
use the top two buttons at left in the Solution Explorer.

IntelliSense
 One useful feature of VB .NET code designers is Microsoft's IntelliSense.
 IntelliSense is what's responsible for those boxes that open as you write your code,
listing all the possible options and even completing your typing for you.
 IntelliSense is one of the first things you encounter when you use VB .NET
 IntelliSense is made up of a number of options, including:
o List Members-Lists the members of an object.
o Parameter Info-Lists the arguments of procedure calls.
o Quick Info-Displays information in tool tips as the mouse rests on elements in
your code.
o Complete Word-Completes typed words.
o Automatic Brace Matching-Adds parentheses or braces as needed.

3 II BCA-III Sem/VB.net 3
Object Explorer
 IntelliSense is useful because it tells you what syntax is correct automatically, or lists all
the members of an object that are available.
 Another useful tool that's too often overlooked by Visual Basic programmers is the
Object Explorer.
 This tool lets you look at all the members of an object at once, which is invaluable to
pry into the heart of object you've added to your code.
 The Object Explorer helps open up any mysterious objects that Visual Basic has added
to your code so you can see what's going on inside.
 The Object Explorer shows all the objects in your program and gives you access to
what's going on in all of them.
By selecting it into the View menu, it's possible to explore all the available objects of
the libraries

 Solution Explorer in Visual Basic.net 2008 contains lists of all the files associated with
a project. It is docked on the right under the Toolbar in the VB IDE
 Solution Explorer has options to view the code, form design, refresh listed files. Projects
files are displayed in a drop down tree like structure, widely used in Windows based
GUI applications.
 You can set the properties of various items in a project by selecting them in the Solution
Explorer and then setting their properties in the properties window.
 And you can set properties of solutions and projects by right-clicking them and selecting
the Properties item in the menu that appears, or you can select an item and click the
properties button, which is the right-most button at the top of the Solutions Explorer.
 VB .NET IDE depends on which solution or project is the current one, and you set that
by selecting it in the Solution Explorer.
 The Solution Explorer tracks the items in your projects; to add new items, you can use
the menu items in the Project menu, such as Add Windows Form and Add User Control.
To add new empty modules and classes to a project (we'll see what these terms mean
in detail in the next chapter), you can use the Project|Add New Items menu item.

Solution
Explorer

Tool box

4 II BCA-III Sem/VB.net 4
 Toolbox contains different tools for your controls
 The toolbox uses tabs to divide its contents into categories; you can see these tabs,
marked Data, Components, Windows Forms, and General. The tabs available, as you
might surmise, depend on the type of project you're working on-and even what type of
designer you're working with. When you're working on a Web form, you'll see Data,
Web Forms, Components, Components, HTML, Clipboard Ring, and General, and so
on.
 The Data tab displays tools for creating datasets and making data connections, the
Windows Forms tab displays tools for adding controls to Windows forms, the Web
Forms tab displays tools for adding server controls to Web forms, and so on.
 The General tab is empty by default, and is a place to store general components,
controls, and fragments of code in.

The Properties Window


 To set an object's properties when you're designing your program in Visual Basic-called
design time (as opposed to run time)-you select that object (by clicking a control or form, or
a project, or a solution), and then set the new property values you want in the Properties
window.
 The Properties window is divided into two columns of text, with the properties on the left,
and their settings on the right.
 To change a property's setting, you only have to click the right-hand column next to the
name of the property, and enter the new setting. Often properties can have only a few
specific values, in which case Visual Basic will display a drop-down list box next to the
property's name when you click the right-hand column, and you can select values from that
list
 Windows form properties in Visual Basic.net 2008 lists the properties of an selected object.
Every object in VB has its own properties that can be used to change the look and even the
functionality of the object.
 Properties Window lists the properties of the forms and controls in an alphabetical order by
default. User also has options to view the properties based on the category they belong to.
 All the Visual Basic Objects can be moved, resized or customized by setting their properties.
A property is a value or characteristic held by a Visual Basic object, such as Caption or Fore
Color.

5 II BCA-III Sem/VB.net 5
The Class View Window
If you click the Class View tab under the Solution Explorer, you'll see the Class View window.
This view presents solutions and projects in terms of the classes they contain, and the members
of these classes.Using the class view window we can find the member of a class that we want
to work with

Using the Class View window gives you an easy way of jumping to a member of class that you
want to access quickly-just find it in the Class View window, and double-click it to bring it up
in a code designer.

The Dynamic Help Window


You can see the Dynamic Help window by clicking the Dynamic Help tab under the
Properties window.
Visual Basic .NET includes the usual Help menu with Contents, Index, and Search
items, of course, but it also now supports dynamic help, which looks things up for you
automatically
VB .NET looks up all kinds of help topics on the element you've selected automatically.

6 II BCA-III Sem/VB.net 6
The Server Explorer
You use the Server Explorer, to explore what's going on in a server, and it's a great tool
to help make distant severs feel less distant, because you can see everything you need in
an easy graphical environment.

The Output Window


If you look at the bottom of the IDE, you'll see two tabs for the Output and Breakpoints
windows. We'll look at the Breakpoints window when we discuss debugging, because it
lets you manage the breakpoints at which program execution halts when you're
debugging your code.
The Output window on the other hand, gives you the results of building and running
programs.

7 II BCA-III Sem/VB.net 7
Output window

The Task List


The Task List is another useful window that not many Visual Basic programmers know about.
To see it, select the View|ShowTasks|All
The Task List displays tasks that VB .NET assumes you still have to take care of, and when you
click a task, the corresponding location in a code designer appears.
There are a number of such tasks; for example, if VB .NET has detected a syntax error,
underlined with a wavy line ,that error will appear in the task list
Component Trays
In VB6, when you added a component to a form, and that component wasn't visible at run time-
such as a timer control-the timer would still appear on the form at design time.
That's changed in VB .NET; now, when you add components that are invisible at run time,
they'll appear in a component tray, which will appear automatically in the designer,

Component tray

The Command Window

Plenty of other windows are available. For example, selecting


View|OtherWindows|CommandWindow opens the Command window.This window is a little
like the Immediate window in VB6, because you can enter commands like File.AddNewProject
here and VB .NET will display the Add New Project dialog box.the command window in the
image displays all possible commands with file
8 II BCA-III Sem/VB.net 8
Creating a Windows Application
 To create an application based on Windows forms, select the New item in the File menu,
then select the Project item in the submenu that appears. This brings up the New Project
dialog box

 Select the folder labeled Visual Basic Projects in the Project Types box,and select the
Windows Application project type in the Templates box.
 You also can name the new project—WinHello—and specify where to storeit.
 Now click the OK button to create this new Visual Basic project.

 The window you see at the centerlabeled Form1, is the window that will become our
new Windows application and this windows are called forms.

9 II BCA-III Sem/VB.net 9
 In this case, I'll just add two Windows controls to this form—a text box and a button.
When you click the button, the application will display the text "Hello from Visual
Basic" in the text box.
 Controls, of course, are user-interface elements that you see in Windows all the time,
such as list boxes, scroll bars, button, menus, and so on. To add a text box to Form1,
first make sure that the Visual Basic toolbox is open. You can see the toolbox to the left
of Form1
 if you don't see the toolbox, select the View|Toolbox menu item to display it. Now click
the Windows Forms item in the toolbox so the toolbox displays the possible controls
you can use in Windows forms, such as text boxes, buttons, labels, link labels, and so
on.
 In a move that's very familiar to Visual Basic programmers, you can now simply drag a
text box from the toolbox to Form1, or just double-click the TextBox entry in the
toolbox.
Give one example refer video for example

Creating a Web Application


 To create a new Web application in Visual Basic, you select the File|New|Project menu
item opening the New Project dialog box as before.
 Select the Visual Basic Projects folder in the Project Types box, also as before, but this
time, select ASP.NET Web Application in the Templates box.Give this new application
the name WebHello,

10 II BCA-III Sem/VB.net 10
 To create a Web application, you need a Web server that uses the Microsoft Internet
Information Server (IIS) version 5.0 or later (with FrontPage extensions installed), and
that server must be running.
 You can enter the location of your server in the Location box in the New Projects dialog
box; if you have IIS running on your local machine, Visual Basic will find it and use
that server by default)
 When you click the OK button, Visual Basic will create the new Web application
Web applications looks much like designing Windows applications.
 You can see a note in the Web form under design—called a page—at the center of the
IDE that says that we're using the Grid layout mode. In this mode, controls will stay
where you position them, just as they did when we created our Windows application
 To close the application, just close the browser window.
 Web application is remarkably similar to our Windows application, and that's the
primary inspiration behind VB .NET—bringing Visual Basic to the Internet.
 Web applications such as this one use HTML to display their controls in a Web page, so
there are more limitations on those controls than on Windows controls, but as you can
see, the design process is very similar

Give one example refer video for example

Creating a Console Application


 There's another new type of Visual Basic application in VB .NET—console
applications.
 These applications are command-line based and run in DOS windows.
 This gives one the feeling once again that VB .NET is following the lead of Java, because
Java applications run in DOS windows in Windows
 However, the change is a welcome one, because it provides us with an option for very
simple programming, without worrying about user interface implementation and issues.
 In this case, because there is no user interface, Visual Basic opens the project directly to
a code window

11 II BCA-III Sem/VB.net 11
 A console application, is an application that takes input and displays output at a
command line console with access to three basic data streams: standard input, standard
output and standarderror.
 A console application facilitates the reading and writing of characters from a console -
either individually or as an entire line. A console application usually exists in the form
of a stand-alone executable file with minimal or no graphical user interface (GUI).

Give one example refer video for example


To Run a Application
 Run a Visual Basic .Net Project by pressing the F5 key or
 by choosing Debug -> Start Debugging from the Menu Bar.or
 by clicking Run button from the standard tool bar

Open Existing Project in VB.NET


 In Visual Studio.net 2008 an existing project can be opened using the Recent
Projects option in the Start Page.
 Visual Basic.net 2008 an existing project can also be opened using the File ->
Open Project from the Menu Bar. Both these displays a window with project
folder, once the project is selected and opened using the file with the
extension .sln for windows application.
 The Solution Browser displays all the components of that project.

Saving the Project………….


 There are many ways for saving a project created using VB.Net 2008. But the
recommended option is File->Save All. This option saves all the files associated with a
project.
 Save all tool from the standard tool bar.
 Beginning also we can save the project with specified location

12 II BCA-III Sem/VB.net 12

You might also like