top of page

The Code

Public Class Form66

    '## Dimension Variables for Calculus ##
    Dim Side1 As Single
    Dim
Side2 As Single
    Dim
HypotenuseSide As Single
    Dim
DecimalPlace As String = ("n3")

    '## Initiate Private Function Hypotenuse Formula ##
    Private Function Hypotenuse(Length1 As Single, Length2 As Single) As Double
       
Hypotenuse = (Length1 ^ 2 + Length2 ^ 2) ^ (1 / 2)
    End Function

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

        '## Hypotenuse Function consists of three Sub Routine ##
        '## Sub Routine(1) ##
        HypotenuseAssign()

        '## Sub Routine (2) ##
        HypotenuseFormula()

        '## Sub Routine (3) ##
        HypotenuseLabel()

    End Sub

    '## Sub(1) ##
    Sub HypotenuseAssign()
       
Side1 = TextBox1.Text
        Side2 = TextBox2.Text
    End Sub

    '## Sub(2) ##
    Sub HypotenuseFormula()
        HypotenuseSide
 = Hypotenuse(Side1, Side2)
    End Sub

    '## Sub(3) ##
    Sub HypotenuseLabel()
       
Label1.Text = HypotenuseSide.ToString(DecimalPlace)
    End Sub

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

        '## Clear TextBox & Labels for Re-Calculus.
        TextBox1.Text = ""
       
TextBox2.Text = ""
       
Label1.Text = ""

    End Sub

End Class

Website Links-173.jpg
bottom of page