top of page
The Code 
Event Driven Programming Language
Website Links-173.jpg

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 into the Picture Box

​

6. Graphic Template below highlights the Positions of TextBox and Label Entries from Tool Box.

        There are Two TextBoxes and Eight LabelBoxes for Entry.

​

7. Changing TextBox and LabelBox Configuration in Properties Windows.

​

        TextBox Configuration

​

        TextBox1 and TextBox2

        Alter set Parameters to :

        Name of TextBox1 = TxtPercentValue

        Name of TextBox2 = TxtDecreasedResult

​

8. Alter Font Parameters on TextBoxes =

        BackColor    = Silver

        San Serif     = 20pt

        ForColor      = Blue

        Text Align    = Center

​

9. Alter Font Parameters on LabelBoxes =

​

        LabelBox Configuration 

​

        Alter Set Parameters to :

        Name of LabelBox1 = LblPercentValue

        Name of LabelBox2LblDecreasedValue

        Name of LabelBox3 = LblDecreasedDivision

        Name of LabelBox4 = LblPercentDivision

        Name of LabelBox5 = LblOriginalResult

        Name of LabelBox6 = LblMultiplyPercent

        Name of LabelBox7 = LblOriginalMultiply

        Name of LabelBox8 = LblMultiplyResult

​

10.  Alter Font Parameters on TextBoxes =

        BackColor    = Silver

        San Serif     = 20pt

        ForColor      = Blue

        Text Align    = Center

​

​

​

​

​

      

​

​

​

​

​

​

​

​

​

Visual Basic 2013 Adobe-p133.jpg
Positioning Template Graph
TextBox & LabelBox Graphic Locations

3 Buttons inserted into Graphic Display

Alter in Property Windows

​

Button1 :  Text = Calculate 

               Name =  Percent_Decrement

​

Button2 :  Text = Clear

               Name = ClearBtn

​

Button3 :  Text = Close

               Name = CloseBtn

​

​

Load Template Design into PictureBox
Use above template to Align Text, Buttons & LabelBoxes
Visual Basic 2013 Adobe-p046.jpg
Once Buttons are Inserted 
In Form.VB Design Mode double Left Click on each Button
to add the Code associated with each Field.

In Form.VB Mode : [1] Press on Project at Menu Headings.

                          [2] Press the [Add Class] Module.

                          [3] Name Class Module - MyClassFindOriginal_PercentageValue

                          [4] Copy Code below into Class Module

​

The Code

​

 

 

 

 

Public Class MyClassFindOriginal_PercentageDecrementValue

​

    '## ======================================================== ##

    '## Percentage Decrement MyClassFindOriginal_PercentageDecrement-------------------##
    '## [1]Encapsulation - Self Contained Modules -----------------------------------------##
    '## [2]Inheritance - Structured Class to be passed by Hierarchy Inheritance ---------------##
    '## [3]Polymorphism - Modules represent Real World Objects known as Classes-----------##
    '## Set Decimal Place to n2 Places ----------------------------------------------------##


    Dim DecimalPlace As String = "n2"

​

    Public Function Original_PercentValue(ByVal DecreasedValue As Single, ByVal DecimalPercentDecreased As Single)

​

        '## Original_PercentValue = Mathematical Configuration ----------------------------------------------##
        '## Original_PercentValue = (Value / ((100 - DecimalPercentDecrease) / 100))-----------------------------##
        '## Hierarchal Parentheses Calculus (Percentage Decrement) --------------------------------------------##

        Original_PercentValue = (DecreasedValue / ((100 - DecimalPercentDecreased) / 100)).ToString(DecimalPlace)

​

        '## ===================================================================##

​

    End Function

​

End Class
 

Public Class Form104

​

​

   
    Private Sub
Percent_Decrement_Click(sender As Object, e As EventArgs) Handles Percent_Decrement.Click

​

​

​


        '##=================Dimension Objects & Variables========================## 
        '## Dimension MyPercentage_OriginalValue as Object ---------------------------------------## 

        Dim MyPercentage_OriginalValue As Object

​

        '## MyPercent_OriginalValue = MyClassFindOriginal_PercentageDecrementValue()--------------##
        MyPercentage_OriginalValue = New MyClassFindOriginal_PercentageDecrementValue()

​

        '## Dimension DecreaseValue, DecimalPercentDecrease as Single Precision ---------------------##
        Dim DecreasedValue, DecimalPercentDecrease As Single
       
'##=============================================================##

​

​

​

​

 

        '## ========== Assign Label Error Format =================================##
        '## Reset Lbl_Answer.Text Forecolor to Blue -------------------------------------------------##

        LblPercentValue.ForeColor = Color.Blue
       
LblDecreasedValue.ForeColor = Color.Blue

        LblDecreasedDivision.ForeColor = Color.Blue
       
LblPercentDivision.ForeColor = Color.Blue
       
LblOriginalResult.ForeColor = Color.Blue

        LblMultiplyPercent.ForeColor = Color.Blue
       
LblOriginalMultiply.ForeColor = Color.Blue
       
LblMultiplyResult.ForeColor = Color.Blue
       
'## =============================================================##

​

​

​

​

 

        '##============== Assign Error HANDLING ================================##
        '## Try... Catch... End Try... Structure ----------------------------------------------------------##
        '## Error Handling Routine ------------------------------------------------------------------##

        Try
           
'##============================================================##

​

​

​

 

            '##============= Assign Numeric TextBox Values ==========================##
            '## ------------ Arithmetic Format Forms -------------------------------------------------##
            '## Assign Numeric Values to Variables ----------------------------------------------------##

            DecimalPercentDecrease = TxtPercentValue.Text
            DecreasedValue = TxtDecreasedResult.Text

​

            '## Assign Values to Label.Text Boxes ------------------------------------------------------##

            '## Hierarchal Parentheses Calculus (Pecentage Decrement as Decimal Value) -------------------##
            LblPercentValue.Text = ((100 - DecimalPercentDecrease) / 100)
           
LblDecreasedValue.Text = DecreasedValue

​

            '## Assign Values to Label.Text Arithmetic Divisional Boxes-----------------------------------##
            LblDecreasedDivision.Text = DecreasedValue

            '## Hierarchal Parentheses Calculus (Pecentage Decrement as Decimal Value) -------------------##
            LblPercentDivision.Text = ((100 - DecimalPercentDecrease) / 100)
           
LblOriginalResult.Text = (MyPercentage_OriginalValue.Original_PercentValue(DecreasedValue, DecimalPercentDecrease))

​

            '## Assign Values to Label.Text Arithmetic Multiplication Boxes ---------------------------------------------------##

            '## Hierarchal Parentheses Calculus (Pecentage Decrement as Decimal Value) -------------------##
            LblMultiplyPercent.Text = ((100 - DecimalPercentDecrease) / 100)
           
LblOriginalMultiply.Text = (MyPercentage_OriginalValue.Original_PercentValue(DecreasedValue, DecimalPercentDecrease))
           
LblMultiplyResult.Text = DecreasedValue
           
'##==========================================================================##

​

​

​

​

 


            '##====================Catch Non_Numeric Exception==================================## 
            '## Try... Catch... End Try... Structure Non_NumericInput As Exception----------------------------------------------##

        Catch Non_NumericInput As Exception
         
  '##==========================================================================##

​

​

​

 


            '##=================Program Flow SubRoutine Error Handling===============================## 
            '## Catch Non Numeric Input as Error --------------------------------------------------------------------------##

            NonNumericInput()
         
  '##==========================================================================##

​

​

​

​

 

            '##======================== End Try [Error Handling] ==================================##
        End Try
       
'##============================================================================##

​

​

​

​

 

    End Sub

​

​

​

​

 

 

    '## =================== Error Handling Subroutine =========================================##
    '## Sub[1] ---------------------------------------------------------------------------------------------------------##
    '## Error Handling Message Routine ---------------------------------------------------------------------------------##

    Sub NonNumericInput()

        LblPercentValue.ForeColor = Color.Red
        LblDecreasedValue.ForeColor = Color.Red

        LblDecreasedDivision.ForeColor = Color.Red
        LblPercentDivision.ForeColor = Color.Red
        LblOriginalResult.ForeColor = Color.Red

        LblMultiplyPercent.ForeColor = Color.Red
        LblOriginalMultiply.ForeColor = Color.Red
        LblMultiplyResult.ForeColor = Color.Red


        LblPercentValue.Text = "Error"
       
LblDecreasedValue.Text = "Error"

        LblDecreasedDivision.Text = "Error"
       
LblPercentDivision.Text = "Error"
       
LblOriginalResult.Text = "Error"

        LblMultiplyPercent.Text = "Error"
       
LblOriginalMultiply.Text = "Error"
       
LblMultiplyResult.Text = "Error"
       
'## ============================================================================##

​

​

​

​

    End Sub

​

​

​

 


    Private Sub ClearBtn_Click(sender As Object, e As EventArgs) Handles ClearBtn.Click

​

​


        '## ============= Clear Text & Label Boxes ===============================================##
        '## Clear Text and Label Boxes for Re-Evaluation --------------------------------------------------------------------##

        TxtPercentValue.Text = ""
       
TxtDecreasedResult.Text = ""

        LblPercentValue.Text = ""
       
LblDecreasedValue.Text = ""

        LblDecreasedDivision.Text = ""
     
  LblPercentDivision.Text = ""
       
LblOriginalResult.Text = ""

        LblMultiplyPercent.Text = ""
       
LblOriginalMultiply.Text = ""
       
LblMultiplyResult.Text = ""
       
'## ============================================================================##

​

​


    End Sub

​

​

​

    Private Sub Form104_Load(sender As Object, e As EventArgs) Handles MyBase.Load

​

​


        '## ====== Delete Label Box Names at Start up Procedure ==============================##
        LblPercentValue.Text = ""
       
LblDecreasedValue.Text = ""

        LblDecreasedDivision.Text = ""
       
LblPercentDivision.Text = ""
       
LblOriginalResult.Text = ""

        LblMultiplyPercent.Text = ""
       
LblOriginalMultiply.Text = ""
       
LblMultiplyResult.Text = ""
       
'## ===================================================================##

​

​


    End Sub

​
 

 

 Private Sub IndexBtn_Click(sender As Object, e As EventArgs) Handles IndexBtn.Click

​

        '## Programs using only [1] Form ============##

        '## Change below to Me.Close()  =============##

​

        '## ====== Go To Menu 97 ===============##

        Form97.Show()
        Me.Hide()

        '## ================================##

​

    End Sub

​

​


End Class

​

​

bottom of page