Documents

VB net1

Description
VB net1
Categories
Published
of 6
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  ArguS academy  VB .NET ---I Page 1   INTRODUCTION ã   Toady the software application are based on distributed computing approach. This approach replaces the traditional development approach development approach wherein the processing was centralized at one location. Distributed computing involves dividing a large application into many small components which may be running on different machines / platforms. ã   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 ã   VB.NET offers capabilities for developing console based applications , web applications as well as windows applications. It can be used with Windows forms to create attractive GUI based application or can be used to create console  – based programs using notepad and the .NET Framework SDK. Basic Structure of a VB.Net Console bases program  Module argus Sub main() System.Console.WriteLine(“Welcome in Argus Academy”)   System.Console.WriteLine(“We are student of Argus Academy”)   System.Console.WriteLine(“VB. Net is OOP ”)  End sub End Module Features of VB .Net VB. NET allows developers to make use of object-oriented features such as classes, interfaces, inheritance and polymorphism. Structured error Handling Error are bound to occur in a program no matter how careful the developer is during program development. Multithreading Multithreading environment each process is broken into one or more threads. These threads when executed by the processor can sometime cause problems. Data type in VB. Net The basic data types supported by VB. Net are Byte: It is an 8 bit data type which can store values in the range from 0 to 255. this data type is used for storing binary data. Short: It is a single 16 bit numeric data type can be hold values in the rang from -32768 to + 32767 Integer: It is a 32-bit numeric data type. It can store values in the range from -2,147,483,648 to +2,147,483,647 Long: It is a signed 64  –  bit numeric data type and it can store values ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Decimal: It is a 128- bit data type that provides support for very large values that can be scaled by powers of 10. Single: It is a 32-bit numeric data type that can store fractional numbers. It can store values ranging from -3.402823E+38 to -1.401298E-45 for negative numbers and from 1.401298E-45 to 3.402823E+38 for positive numbers; Double: It is a 64-bit Numeric data type for fractional numbers. Boolean: It is a 16 bit data type that represents a true or False. Char: It is a 16-bit data type and can store Unicode values. String : A String can contain 2 31 Unicode character. Object: The object data type is a universal datatype. Operators in VB.Net Operator in VB.Net can be classified into the following categories: Arithmetic Operators:-  These operators are used to form arithmetic expressions. Typically, they are used with variables of numeric data types. Operator Purpose / Division ^ Exponentiation * Multiplication  ArguS academy  VB .NET ---I Page 2   + Addition - Subtraction MOD Remainder of division Logical Operators:-  These operators are used for bitwise operations. Relational Operators:-  These operators are used for comparing values. They are typically used in loops and decision constructs. Operator Purpose = Equal to > Greater than < Less than <> Not equal to >= Greater than or equal to <= Less than or equal to IS Determines if 2 variables references the same object. Assignment Operators :- VB.Net supports assignment operators such as += and -= and so on. For instance, a=a+9 can be written as a+=9. the list of shortcuts is given below: Shortcut Operator Original Expression Using Shortcuts += x=x+1 x+=1 -= x=x-1 x-=1 *= x=x*1 x*=1 /= x=x/1 x/=1 Example of Arithmetic Operator: Module m1 Sub main() Dim a as integer Dim b as integer Dim c as integer a=10 b=2 c=a+b System.Console.writeLine(“Sum of a & b = ”&c)  c=a-b System.Console.WriteLine(“Sub of a & b= ” &c) c=a*b System.Console.WriteLine(“Pro of a & b =”&c)  c=a/b System.Console.WriteLine(“Div of a & b =”&c)  c=a MOD b System.Console.WriteLine(“a Mod b =”&c)  End sub End module Example of Logical Operator: Module m1 Sub main() Operator Purpose AND Logical AND OR Logical OR NOT Logical NOT EQV Logical Equivalence IMP Logical Implication  ArguS academy  VB .NET ---I Page 3   Dim a as integer Dim b as integer a =5 b=6 System.Console.WriteLine(“a MOD b = ”&(a and b))   System.Console.WriteLine(“a OR b =” &(a OR b)) System.Console.WriteLine(“NOT a=”&(NOT a) ) End sub End Module Typecasting: Sometimes, it may so happen that operands of two different data types may be used in an expression or the data type of the result of an expression may be different from the data type of the operands. In order to obtain accurate result it becomes necessary to convert the data type of one operand to another type. Option strict on Module m3 Sub main () Dim num1 as single Dim num2 as double num2 =5.5 num1 =CType(num2,Single) System.Console.WriteLine(num1) End sub End module Input from User Module m3 Sum main() Dim a as integer Dim b as integer Dim c as integer System.Console.WriteLine(“Enter the value of a ”)  a=System.Console.ReadLine() System.Console.WriteLine(“Enter the value of b”)  b=System.Console.ReadLine() System.Console.WriteLine(“Value of a =” &a) System.Console.WriteLine( “Value of b=”&b)  c=a+b System.Console.WriteLine(“Sum of a & b=”&c)  End sub End module Decision Constructs Whenever an action has to be taken on the outcome of a condition, decision construct comes into picture. VB.NET supports decision constructs in the form of: If … end if statements   If…Elseif …End if statements If….Elseif….Else …. End if statement and Select…case … End Select statements.   If …end if condition   Module m4 Sub main() Dim age as integer System.Console.WriteLine(“Enter age”)  age=System.Console.ReadLine() if age>=18 then System.Comsole.WriteLine(“Egigible for vote ”)  End if End sub  ArguS academy  VB .NET ---I Page 4   End module If … Else … end if condition Module m5 Sub main() Dim age as integer System.Console.WriteLine(“Enter age”)  age=System.Console.ReadLine() if age>=18 then System.Comsole.WriteLine(“Egigible for vote ”)  Else System.Console.WriteLine(“Not Eligible for Vote”)  End if End sub End module If …Elseif…Else end if condition Module m6 Sub main() Dim grade as char System.Console.WriteLine(“Enter grade”)  grade=System.Console.ReadLine() if grade=”A”   System.Console.WriteLine(“Commission = 20000”)   Elseif grade=”B”   System.Console.WriteLine(“Commission = 10000”)  Else System.Console.WriteLine(“Commission = 5000”)  End if End sub End module Nested if Condition Module m7 Sub main() Dim marks as integer System.Console.WriteLine(“Enter marks”)  marks=System.Console.ReadLine() if marks>=60 then if marks>=90 System.Console.WriteLine(“Selected for Interview”)  Else System.Console.WriteLine(“You have selected for 2 nd   round”)  End if Else If marks>=50 then System.Console.writeLine(“You have selected but waiting”)  Else System.Console.WriteLine(“Not Selected”)  End if End if End sub End module Select Case Statement Module m8 Sub main() Dim roll as integer System.Console.WriteLine(“Enter Roll No”)  
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks