Tutorial by Examples

The first interesting thing to know is how to write comments. In VB .NET, you write a comment by writing an apostrophe ' or writing REM. This means the rest of the line will not be taken into account by the compiler. 'This entire line is a comment Dim x As Integer = 0 'This comment is here to say...
One interesting thing is the ability to add you own comments into Visual Studio Intellisense. So you can make your own written functions and classes self-explanatory. To do so, you must type the comment symbol three times the line above your function. Once done, Visual Studio will automatically add...
In VB.NET, every variable must be declared before it is used (If Option Explicit is set to On). There are two ways of declaring variables: Inside a Function or a Sub: Dim w 'Declares a variable named w of type Object (invalid if Option Strict is On) Dim x As String 'Declares a variable named ...
Modifiers are a way to indicate how external objects can access an object's data. Public Means any object can access this without restriction Private Means only the declaring object can access and view this Protected Means only the declaring object and any object that inherits from...
A function is a block of code that will be called several times during the execution. Instead of writing the same piece of code again and again, one can write this code inside a function and call that function whenever it is needed. A function : Must be declared in a class or a module Returns a...
Named Types Dim someInstance As New SomeClass(argument) With { .Member1 = value1, .Member2 = value2 '... } Is equivalent to Dim someInstance As New SomeClass(argument) someInstance.Member1 = value1 someInstance.Member2 = value2 '... Anonymous Types (Option...
Arrays Dim names = {"Foo", "Bar"} ' Inferred as String() Dim numbers = {1, 5, 42} ' Inferred as Integer() Containers (List(Of T), Dictionary(Of TKey, TValue), etc.) Dim names As New List(Of String) From { "Foo", "Bar" '... ...

Page 1 of 1