top of page
Visual Basic 2013 Adobe-p136.jpg
The Code
Website Links-173.jpg
images (3).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 three LabelBoxes for Entry.

7. Changing TextBox and LabelBox Configuration in Properties Windows.

        TextBox Configuration

        TextBox1 and TextBox2

        Alter set Parameters to :

        Name of TextBox1 = TxtInch_Millimetre

        Name of TextBox2 = Millimetre_Inch

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 = LblMillimetre_Inch

        Name of LabelBox2LblInch_Millimetre

        Name of LabelBox3 = LblErrorMessage

       

10.  Alter Font Parameters on TextBoxes =

        BackColor    = Silver

        San Serif     = 20pt

        ForColor      = Blue

        Text Align    = Center

      

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

3 Buttons inserted into Graphic Display

Alter in Property Windows

Button1 :  Text = Calculate 

               Name =  Btn_Calculate

Button2 :  Text = Clear

               Name = Btn_Clear

Button3 :  Text = Close

               Name = Btn_Clear

Load Template Design into PictureBox
Use above template to Align Text, Buttons & LabelBoxes
Visual Basic 2013 Adobe-p137.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

Public Class MyMetric_ImperialConversion

    '## ============Public Class Metric to Imperial Conversion============= ##

    '## ============================ Public Class Functions ==========##
    '## [1]Encapsulation - Self Contained Modules -------------------------------------##
    '## [2]Inheritance - Structured Class to be passed by Hierarchy Inheritance -----------##
    '## Inheritance lets you focus on adding unique application features.You don't -------##
    '## have to keep reinventing the wheel by rewriting existing code repeatedly. --------##

    '## [3]Polymorphism - Modules represent Real World Objects known as Classes-------##

    '## =========Multiply_Formula Applications ======================== ##


    '## Public Class Module MyClassMultiply_FormulaApplications ##
    '## ------Contains a List of Formula Applications---------- ##
    '## -- Class Modules can be used for Program Applications - ## 

 

    '## ====== Delcare Decimal Place Value============ ##
    Dim DecimalPlace As String = "n2"

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

 

    '## ============== [1] Millimetre = (0.0393700787) of an Inch =========== ##
    Public Function Millimetre_InchFormula(ByVal Millimetre_Inch As Single)
       
Millimetre_InchFormula = (Millimetre_Inch * 0.0393700787).ToString(DecimalPlace)
    End Function
   
'## ===================================================== ##


    '## ============== [1] Inch = (25.4) Millimetres ===================== ##
    Public Function Inch_MillimetreFormula(ByVal Inch_Millimetre As Single)
       
Inch_MillimetreFormula = (Inch_Millimetre * 25.4).ToString(DecimalPlace)
    End Function
   
'## ===================================================== ##

 

 

 

End Class
 

Public Class Form111

    

    
    Private Sub BtnCalculate_Click(sender As Object, e As EventArgs) Handles BtnCalculate.Click

 

        '##=================Dimension Objects & Variables================## 
        '## ================Dimension Length Conversions as Object --------------## 

        Dim MyMillimetre_InchConversion As Object
        Dim
MyInch_MillimetreConversion As Object
       
'## =====================================================##

 

        '## Length Conversion Objects = MyClassMillimetre_InchConversion =========== ##
        MyMillimetre_InchConversion = New MyMetric_ImperialConversion()
       
MyInch_MillimetreConversion = New MyMetric_ImperialConversion()
        '## ===================================================== ##

 

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

        LblInch_Millimetre.ForeColor = Color.Blue
       
LblMillimetre_Inch.ForeColor = Color.Blue
     
  '## ======================================================##

 


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

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

 

 

            '## ==============Dimension Variables as Single Precision ===========##
            Dim Millimetre_Inch As Single
            Dim
Inch_Millimetre As Single
           
'##===================================================##

 


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

            Millimetre_Inch = TxtMillimetre_Inch.Text
            Inch_Millimetre = TxtInch_Millimetre.Text
            '## ===================================================##

 

 

            '## ============Assign Value to Label.Text Length Conversion Calculus ============##
            LblMillimetre_Inch.Text = (MyMillimetre_InchConversion.Millimetre_InchFormula(Millimetre_Inch))
           
LblInch_Millimetre.Text = (MyInch_MillimetreConversion.Inch_MillimetreFormula(Inch_Millimetre))
           
'##============================================================##

 

 

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

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

 

            '##===========Program Flow SubRoutine [1] 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()

        LblErrorMessage.Visible =True

        LblErrorMessage.ForeColor = Color.Red

        

        LblInch_Millimetre.ForeColor = Color.Red
        LblMillimetre_Inch.ForeColor = Color.Red


        LblInch_Millimetre.Text = "Error Non Numeric"
       
LblMillimetre_Inch.Text = "Error Non Numeric"

        LblErrorMessage.Text = "One or Two Entries were Non-Numeric?"


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

    End Sub


   

 

 

    Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles BtnClear.Click

 

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


        TxtMillimetre_Inch.Text = ""
       
TxtInch_Millimetre.Text = ""
       
LblMillimetre_Inch.Text = ""
       
LblInch_Millimetre.Text = ""

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

 

    End Sub

 


    Private Sub BtnIndex_Click(sender As Object, e As EventArgs) Handles BtnIndex.Click

 

        '## ====== Revert to Index Form 105 ========================= ##
        Form105.Show()
        Me.Hide()
     
  '## ================================================ ##

 

    End Sub

 


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

 

        '## ========Clear Labels at Initial Startup Procedure================ ##
        LblMillimetre_Inch.Text = ""
       
LblInch_Millimetre.Text = ""

        LblErrorMessage.Visible = False

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

 

    End Sub

 

End Class

bottom of page