top of page

The Code

 

 

 

 

Public Class Form69

    '## Scope of Declaration = Public Class accessible to Whole Program
    '## Sub Routine Program Flow - Variable = Accessible by Public Class

    '## Variable (u) Function = ByRef - Passed by Reference
    Dim u As Single = 9

    '## Variable (u1) Function = ByVal - Passed by Value
    Dim u1 As Single = 9

    '## Functions can be called by (Value) or called by (Reference)
    '## By default, the Arguments are passed by (Reference).
    '## Original Data will be modified and (No Longer Preserved).
    '## On one Hand, if Arguments are passed by (Value), original
    '## Data will be preserved. The keyword to pass Arguments
    '## By (Reference) is (ByRef) and the keyword to pass Arguments 
    '## by (Value) is (ByVal).

    '## Example :
    '## Private Function FV(ByVal PV AS Single, ByRef i as Single, n as Integer) as Double

    Private Function sqroot(ByRef x As Single) As Double
       
'## Exponential x = x ^ 0.5 - (Decimal Equation Sqrt ( x^0.5 ) ) ##
        x = x ^ 0.5
       
sqroot = x
    End Function

    Private Function sqroot1(ByVal y As Single) As Double
       
'## Exponential y = y ^ 0.5 (Decimal Equation Sqrt ( y^0.5 ) ) ##
        y = y ^ 0.5
       
sqroot1 = y
    End Function

    Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click

        '## Subroutine Program Flow Orientation ##


        '## Sub Routine (1) ##
        '## Calculus = ByRef (By Reference)
        '## Original Data will be Modified by Calculus (u=3) ##

        SqrootByReference()

        '## Sub Routine (2) ##
        '## Calculus = ByVal (By Value)
        '## Original Data being preserved (u1=9) ##

        Sqroot1ByValue()

    End Sub

    '## Sub(1) ##
    Sub SqrootByReference()
       
Label1.Text = (3 * sqroot(u))
       
Label2.Text = u
    End Sub

    '## Sub(2) ##
    Sub Sqroot1ByValue()
       
Label3.Text = (3 * sqroot1(u1))
       
Label4.Text = u1
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        '## Clear Label Text ##
        Label1.Text = ""
       
Label2.Text = ""
       
Label3.Text = ""
       
Label4.Text = ""

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        '## Show Index ##

        Form65.Show()
        Me.Hide()

    End Sub

End Class

Website Links-173.jpg
bottom of page