FEDT VB NET- Creating VB .Net Project

Preview:

Citation preview

TRINITY INSTITUTE OF PROFESSIONAL STUDIES

Sector – 9, Dwarka Institutional Area, New Delhi-75Affiliated Institution of G.G.S.IP.U, Delhi

Priyanka RattanAssistant Professor(IT)

BCA, FEDT VB .NET,20205

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Topics

• Introduction to VB .Net• Creating VB .Net Project in VS 2005• Data types and Operators in VB .Net• Conditions (If Else, Select Case)• Loops (Do While, Do Until, For)• Classes, Objects• Sub routines and Functions

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Introduction

• VB .Net is developed by Microsoft• It is Visual Basic for .Net Platform• Ancestor of VB .Net is BASIC• In 1991, Microsoft added visual components

to BASIC and created Visual Basic• After the development of .Net, VB was added

with more set of controls and components and thus evolved a new language VB .Net

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Pros and Cons

• Pros– Faster development of programs– Rich set of controls– Object Orientation of language enhances

modularity, readability and maintainability• Cons– Debugging larger programs is difficult, due to the

absence of an effective debugger

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Features of VB .Net

• Object Oriented Language• We can drag controls from the tool bar and

drop them on the form and write code for the controls

• Runs on the CLR (Common Language Runtime)• Release of unused objects taken care by the

CLR

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Creating VB .Net Project in VS 2005

• Open Visual Studio 2005• Click File -> New -> Project• Choose Language as VB .Net• Choose Type (Either Console Application or

what ever we want)• Give the path under which the project need to

be saved• Click OK

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Data types and Operators in VB .Net

• Data types– Integer, string, single, double, boolean, char

• Operators– Arithmetic (+,-,*,/,\,Mod)– Logical (Or, And)– Relational (=,<>,<,<=,>,>=)

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

If Else

If (Condition)ThenStatements executed if condition is trueElseStatements executed if condition is falseEndIf

We can also have Else If block in If Else statements

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Select Case

Select Case varCase 1stmt1 // executed if var = 1Case 2stmt2 // executed if var = 2Case Elsestmt3 // executed if var is other than 1 and 2

End Select

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

For Loop

For <<var>> = start To end Step <<val>>Statements

Next

EgFor I = 1 To 10 Step 2

msgbox(l)NextHere the values printed will be 1,3,5,7,9

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Do While Loop

1. Do While(a<>0) msgbox(a)a = a – 1Loop

2. Do msgbox(a)

a = a – 1 Loop While(a<>0)

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Do Until Loop

1. Do Until(a=0) msgbox(a)a = a – 1Loop

2. Do msgbox(l)

a = a – 1 Loop Until(a=0)

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Class

• Software structure that is important in Object Oriented Programming

• Has data members and methods• Blue print or proto type for an object• Contains the common properties and methods

of an object• Few examples are Car, Person, Animal

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Object

• Instance of a class• Gives Life to a class• Ram is an object belonging to the class Person• Ford is an object belonging to the class Car• Jimmy is an object belonging to the class

Animal

TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, Dwarka Institutional Area, New Delhi-75

Subroutines and Functions

• Subroutines– Does not return any value– Can have zero or more parameters

• Functions– Always Returns some value– Can have zero or more parameters