Shane Partridge
Visual Basic 2013
The Code
Public Class MyClassFindOriginal_PercentageValue
'## Percentage Increment MyClassMyClassPercentageIncrement---- ----------------------##
'## [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 IncreasedValue As Single, ByVal DecimalPercentIncrease As Single)
'## Original_PercentValue = Mathematical Configuration -------------------------------------##
'## Original_PercentValue = (Value / ((1+(DecimalPercentIncrease/100))))-----------------------##
Original_PercentValue = (IncreasedValue / ((1 + (DecimalPercentIncrease / 100)))).ToString(DecimalPlace)
End Function
End Class
Public Class Form103
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles OriginalValue.Click
'##=================Dimension Objects & Variables========================##
'## Dimension MyPercent_Increment as Object ----------------------------------------------##
Dim MyPercentage_OriginalValue As Object
'## MyPercent_Increment = MyClassPercentage_Increment() ---------------------------------##
MyPercentage_OriginalValue = New MyClassFindOriginal_PercentageValue()
'## Dimension Value, DecimalPercent as Single Precision --------------------------------------##
Dim IncreasedValue, DecimalPercentIncrease As Single
'##=============================================================##
'## ========== Assign Label Error Format =================================##
'## Reset Lbl_Answer.Text Forecolor to Blue -------------------------------------------------##
LblPercentValue.ForeColor = Color.Blue
LblIncreasedResult.ForeColor = Color.Blue
LblIncreasedDivision.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 ----------------------------------------------------##
DecimalPercentIncrease = TxtPercentValue.Text
IncreasedValue = TxtIncreasedResult.Text
'## Assign Values to Label.Text Boxes ------------------------------------------------------##
LblPercentValue.Text = (1 + (DecimalPercentIncrease / 100))
LblIncreasedResult.Text = IncreasedValue
'## Assign Values to Label.Text Arithmetic Divisional Boxes-----------------------------------##
LblIncreasedDivision.Text = IncreasedValue
LblPercentDivision.Text = (1 + (DecimalPercentIncrease / 100))
LblOriginalResult.Text = (MyPercentage_OriginalValue.Original_PercentValue(IncreasedValue, DecimalPercentIncrease))
'## Assign Values to Label.Text Arithmetic Multiplication Boxes --------------------------------##
LblMultiplyPercent.Text = (1 + (DecimalPercentIncrease / 100))
LblOriginalMultiply.Text = (MyPercentage_OriginalValue.Original_PercentValue(IncreasedValue, DecimalPercentIncrease))
LblMultiplyResult.Text = IncreasedValue
'##=============================================================##
'##====================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
LblIncreasedResult.ForeColor = Color.Red
LblIncreasedDivision.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"
LblIncreasedResult.Text = "Error"
LblIncreasedDivision.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 = ""
TxtIncreasedResult.Text = ""
LblPercentValue.Text = ""
LblIncreasedResult.Text = ""
LblIncreasedDivision.Text = ""
LblPercentDivision.Text = ""
LblOriginalResult.Text = ""
LblMultiplyPercent.Text = ""
LblOriginalMultiply.Text = ""
LblMultiplyResult.Text = ""
'## ==================================================================##
End Sub
Private Sub Form103_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'## ====== Delete Label Box Names at Start up Procedure ==============================##
LblPercentValue.Text = ""
LblIncreasedResult.Text = ""
LblIncreasedDivision.Text = ""
LblPercentDivision.Text = ""
LblOriginalResult.Text = ""
LblMultiplyPercent.Text = ""
LblOriginalMultiply.Text = ""
LblMultiplyResult.Text = ""
'## ===================================================================##
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'## ========= Transfer Control back to Form97 Menu =================================##
Form97.Show()
Me.Hide()
'## ====================================================================##
End Sub
End Class