Shane Partridge
Visual Basic 2013
The Code
Public Class Form8
Dim PerIncrease As Single
Dim DecimalValue As Single
Dim IncAmount As Single
Dim OrigAmount As Single
Dim Whole As Single = 100
Dim N As String = "n3"
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'###Program Layout Organised by Sub-Routine Access###
'## Sub(1) Add Values to TextBox for Calculus ##
AddValueTextBox()
'## Sub(2) Calculate Variables ==========##
CalculateVariables()
'## Sub(3) Assign Values to Labels =======##
AssigntoLabels()
End Sub
'## Sub(1) =========================##
Sub AddValueTextBox()
PerIncrease = TextBox1.Text 'Assign % Value to TextBox1
IncAmount = TextBox2.Text 'Assign Increased Amount to TextBox2
End Sub
'## Sub (2) =========================##
Sub CalculateVariables()
DecimalValue = (1 + (PerIncrease / Whole)) 'Compute %age to Decimal Value
OrigAmount = (IncAmount / (DecimalValue)) 'Calculate Original by Division
End Sub
'## Sub(3) ==========================##
Sub AssigntoLabels()
Label1.Text = DecimalValue 'Label1 = Decimal Value
Label2.Text = IncAmount 'Label2 = Increased Amount
Label3.Text = IncAmount 'Label3 = Increased Amount
Label4.Text = DecimalValue 'Label4 = Decimal Value
Label5.Text = OrigAmount.ToString(N) 'Label5 = Original Amount
Label6.Text = DecimalValue 'Label6 = Decimal Value
Label7.Text = OrigAmount.ToString(N) 'Label7 = Original Amount
Label8.Text = IncAmount 'Label8 = Inctreased Amount
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'## Clear Variables for Re-Calculus ===========##
TextBox1.Text = ""
TextBox2.Text = ""
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
Label4.Text = ""
Label5.Text = ""
Label6.Text = ""
Label7.Text = ""
Label8.Text = ""
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
'## Return to Menu [1] ==================##
Form1.Show()
Me.Hide()
End Sub
End Class