VB.NET TUTORIALS - VB.Net - Basic Syntax
VB.Net - Basic Syntax
ADVERTISEMENTS
VB.Net Keywords
AddHandler | AddressOf | Alias | And | AndAlso | As | Boolean |
ByRef | Byte | ByVal | Call | Case | Catch | CBool |
CByte | CChar | CDate | CDec | CDbl | Char | CInt |
Class | CLng | CObj | Const | Continue | CSByte | CShort |
CSng | CStr | CType | CUInt | CULng | CUShort | Date |
Decimal | Declare | Default | Delegate | Dim | DirectCast | Do |
Double | Each | Else | ElseIf | End | End If | Enum |
Erase | Error | Event | Exit | False | Finally | For |
Friend | Function | Get | GetType | GetXML Namespace | Global | GoTo |
Handles | If | Implements | Imports | In | Inherits | Integer |
Interface | Is | IsNot | Let | Lib | Like | Long |
Loop | Me | Mod | Module | MustInherit | MustOverride | MyBase |
MyClass | Namespace | Narrowing | New | Next | Not | Nothing |
Not Inheritable | Not Overridable | Object | Of | On | Operator | Option |
Optional | Or | OrElse | Overloads | Overridable | Overrides | ParamArray |
Partial | Private | Property | Protected | Public | RaiseEvent | ReadOnly |
ReDim | REM | Remove Handler | Resume | Return | SByte | Select |
Set | Shadows | Shared | Short | Single | Static | Step |
Stop | String | Structure | Sub | SyncLock | Then | Throw |
To | True | Try | TryCast | TypeOf | UInteger | While |
Widening | With | WithEvents | WriteOnly | Xor |
ADVERTISEMENTS
A Rectangle Class in VB.Net
Imports System Public Class Rectangle Private length As Double Private width As Double 'Public methods Public Sub AcceptDetails() length = 4.5 width = 3.5 End Sub Public Function GetArea() As Double GetArea = length * width End Function Public Sub Display() Console.WriteLine("Length: {0}", length) Console.WriteLine("Width: {0}", width) Console.WriteLine("Area: {0}", GetArea()) End Sub Shared Sub Main() Dim r As New Rectangle() r.Acceptdetails() r.Display() Console.ReadLine() End Sub End ClassADVERTISEMENTS
Dim r As New Rectangle()
Shared Sub Main() Dim r As New Rectangle() r.Acceptdetails() r.Display() Console.ReadLine() End Sub