Visual Basic .NET (pl, appeared 2001)
Also known as: vb.net VisualBasic.NET
Origin: Microsoft
Website: https://docs.microsoft.com/dotnet/visual-basic/
File extensions: vb
Keywords: AddHandler
AddressOf
Alias
And
AndAlso
As
Boolean
ByRef
Byte
ByVal
Call
Case
Catch
CBool
CByte
CChar
CDate
CDbl
CDec
Char
CInt
Class
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
EndIf
Enum
Erase
Error
Event
Exit
False
Finally
For
For
Friend
Function
Get
GetType
GetXMLNamespace
Global
GoSub
GoTo
Handles
If
Implements
Implements
Imports
In
Inherits
Integer
Interface
Is
IsNot
Let
Lib
Like
Long
Loop
Me
Mod
Module
Module
MustInherit
MustOverride
MyBase
MyClass
Namespace
Narrowing
New
New
Operator
Next
Not
Nothing
NotInheritable
NotOverridable
Object
Of
On
Operator
Option
Optional
Or
OrElse
Out
Overloads
Overridable
Overrides
ParamArray
Partial
Private
Property
Protected
Public
RaiseEvent
ReadOnly
ReDim
REM
RemoveHandler
Resume
Return
SByte
Select
Set
Shadows
Shared
Short
Single
Static
Step
Stop
String
Structure
Structure
Sub
SyncLock
Then
Throw
To
True
Try
TryCast
TypeOf
UInteger
ULong
UShort
Using
Variant
Wend
When
While
Widening
With
WithEvents
WriteOnly
Xor
#Const
#Else
#ElseIf
#End
#If
=
&
&=
*
*=
/
/=
\
\=
^
^=
+
+=
-
-=
>>
>>=
<<
<<=


Visual Basic .NET (VB.NET) is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language. Although the ".NET" portion of the name was dropped in 2005, this article uses "Visual Basic [.NET]" to refer to all Visual Basic languages released since 2002, in order to distinguish between them and the classic Visual Basic. Along with Visual C#, it is one of the two main languages targeting the .NET framework. Microsoft's integrated development environment (IDE) for developing in Visual Basic .NET language is Visual Studio. Most Visual Studio editions are commercial; the only exceptions are Visual Studio Express and Visual Studio Community, which are freeware. In addition, the .NET Framework SDK includes a freeware command-line compiler called vbc.exe. Mono also includes a command-line VB.NET compiler.


Imports System.Console

Module Program

    Sub Main()
        Dim rows As Integer

        ' Input validation.
        Do Until Integer.TryParse(ReadLine("Enter a value for how many rows to be displayed: " & vbcrlf), rows) AndAlso rows >= 1
            WriteLine("Allowed range is 1 and {0}", Integer.MaxValue)
        Loop
      
        ' Output of Floyd's Triangle
        Dim current As Integer = 1
        Dim row As Integer 
        Dim column As Integer
        For row = 1 To rows
            For column = 1 To row
                Write("{0,-2} ", current)
                current += 1
            Next

            WriteLine()
        Next
    End Sub

    ''' <summary>
    ''' Like Console.ReadLine but takes a prompt string.
    ''' </summary>
    Function ReadLine(Optional prompt As String = Nothing) As String
        If prompt IsNot Nothing Then
            Write(prompt)
        End If

        Return Console.ReadLine()
    End Function

End Module