top of page

OOP Language : Pythagoras Theorem Calculus.

Visual Basic - An Event Driven Programming Language

Building the GUI-Based Programming Language

by Inserting Controls from the Tool Box.

1. Right Click on Graphics Template Image : Then Press Save Image as to Folder

      - The Graphics Template Chart below corresponds to the Tool Box Controls

      - Making Graphic User Interface [GUI] Easier to Build.

2. Copy Coding onto Forms VB for Program Execution.

3. In VB Design Mode : Drag Picture Box from Tool Box.

4. Set Picture Box Size Mode to Stretch Image.

         In Forms Design Mode - Properties set Size to (1069,805)

         In PictureBox Properties - Set Size to (1012,726)

 

5. Download Graphic Template Image below from allocated Folder.

In Private Sub Button_1 if only 1 Form is being used.

Terminate Form9.Show()

               Me.Hide()

Then add  Me.Close()  ' To Close Program.

Follow and Insert the TextBox, LabelBox and Button Controls from ToolBox

and allocate them on the Graphics.

The Program Calculates the Hypotenuse Length using Pythagoras Theorem.

      

Visual Basic 2013 Adobe-31.jpg

Public Class Form16

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

        'Dimension Variables
        Dim a, b, c As Double       'Double Precision Accuracy
        Dim n As String = "n4"    'String Decimal No. Decimal Placing

        a = TextBox1.Text
        b = TextBox2.Text

        'Pythagoras Formula
        c = (a ^ 2 + b ^ 2) ^ (1 / 2)
       
Label1.Text = c.ToString(n)    'n = No. of Decimal Placings 

    End Sub

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

        Form9.Show()
        Me.Hide()

    End Sub

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

        'Clear TextBox & Label Box
        TextBox1.Text = ""
       
TextBox2.Text = ""
       
Label1.Text = ""

    End Sub

End Class

bottom of page