Program Structure

1.10 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

 



VB. NET Language Pocket Reference
VB.NET Language Pocket Reference
ISBN: 0596004281
EAN: 2147483647
Year: 2002
Pages: 31

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net