Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

VB.Net Class Definition. My filename: VB2.txt - Subs and Functions

'Name:  VB2, ID: 9DcLsk
'Date:  04/04/19
'https://www.tutorialspoint.com/compile_vb.net_online.php
 
module VBModule
 Class TestClass1           'Start of class
    'Public sub TC1_TestSub1()  'This works. What function does 'public' serve?
    sub TC1_TestSub1()          'This works
        Console.WriteLine("Hello, TestClass1: TC1_TestSub1")
    End sub
    Public sub TC1_TestSub2()
        Console.WriteLine("Hello, TestClass1: TC1_TestSub2")
    End sub'
 End Class
  Class TestClass2           'Start of class
    function TC2_TestSub1() as boolean         
        Console.Writeline("Hello, TestClass2: TC2_TestSub1")
        Return true
    End function
 End Class
'**********************************************
'Vars defined in Classes
    dim MyTest1 as TestClass1 = new TestClass1  '"NEW" is needed
    dim MyTest2 as TestClass2 = new TestClass2
'locals?
    dim Testflg1 as boolean         'Initial value nor defined, default = 0
    dim Testflg2 as boolean = true  'Initial value defined

 Sub Main()
    Console.WriteLine("Hello, world!" & environment.newline )
    Console.WriteLine("Hello, world_1!")
    Console.WriteLine("MyVar values: Testflg1: " & Testflg1)
    Console.WriteLine("MyVar values: Testflg2: " & Testflg2)
        
    MyTest1.TC1_TestSub1()
    MyTest1.TC1_TestSub2()
    Console.WriteLine("Hello, TestClass2: TC2_TestSub1() ret value is: " & MyTest2.TC2_TestSub1)
 End Sub
End module

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.