Program Structure
When a class or structure is instantiated, its class constructor (which in VB is a subroutine named New) is automatically invoked. In addition, each executable requires an entry point in the form of a function or subroutine named Main. For example:
Public Class PgmStruct Private Value As Integer Public Sub New(x As Integer) Value = x End Sub Public Shared Sub Main( ) Dim obj As New PgmStruct(100) Console.WriteLine(obj.Value) End Sub End Class
Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.