Shane Partridge
Visual Basic 2013
The Code
Public Class Form1
'## Private Sub RadioRandom Routine ##
'## RadioButton.Checked Mathematical Random Argumentation ##
'## Incorporate Subroutines [1 to 3] ##
'## ----------------------------------------------------- ##
'## Private Sub RadioOperator Routine ##
'## RadioButton.Checked Mathematical Operator Selection ##
'## Incorporates Subroutines [4 to 6] ##
'## --------------------------------------------------- ##
'## Private Sub RandomArgument Button Calcus ##
'## Formulate Mathematical Argument Labelling ##
'## ----------------------------------------- ##
'## Private Sub InitialClear Button at Startup ##
'## Clears Labels at Startup Procedure ------- ##
'## Labels were named during Program Procedure ##
'## ------------------------------------------- ##
'## Private Sub ClearValues.Button ------------- ##
'## Clear Numeric Variables to Zero ------------ ##
'## Clear AlhpaNumberic Variables to Null String ##
'## ----------------------------------------- ##
'## Dimension Variable in Public Class ------------ ##
'## For Transitioning through Programing Sub Stages ##
Dim a, b As Integer
Dim Answer As Single
Dim TT As Integer
Dim MathSign As String
Dim Correct As String = "Correct"
Dim Incorrect As String = "Incorrect"
Private Sub RadioRandom_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked Then
'## Subroutine[1] Random1Variable ##
Random1Variable()
ElseIf RadioButton2.Checked Then
'## Subroutine[2] Random2Variable ##
Random2Variable()
Else
'## Subroutine[3] Random3Variable ##
Random3Variable()
End If
'## Assign Random Variable to Label.Text ##
LbRandoma.Text = a
LbRandomb.Text = b
End Sub
'## Sub[1] ##
'## Random Result between 10 and 20 ##
Sub Random1Variable()
a = (10 * Rnd() + 10)
b = (10 * Rnd() + 10)
End Sub
'## Sub[2] ##
'## Random Result between 20 and 30 ##
Sub Random2Variable()
a = (20 * Rnd() + 10)
b = (20 * Rnd() + 10)
End Sub
'## Sub[3] ##
'## Random Result between 30 and 40 ##
Sub Random3Variable()
a = (30 * Rnd() + 10)
b = (30 * Rnd() + 10)
End Sub
Private Sub RadioOperator_Click(sender As Object, e As EventArgs) Handles Button2.Click
If RadioAddition.Checked Then
'## Subroutine[4] Addition Argument ##
AdditionArgument()
ElseIf RadioSubtraction.Checked Then
'## Subroutine[5] Subtraction Argument ##
SubtractionArgument()
Else
'## Subroutine [6] Multiplication Argument ##
MultiplicationArgument()
End If
'## Assign Random Variable to Label.Text ##
Sign.Text = MathSign
End Sub
'## Sub[4] ##
Sub AdditionArgument()
TT = a + b
'## Chr (43) = Asc (+) Addition Sign ##
MathSign = Chr(43)
End Sub
'## Sub[5] ##
Sub SubtractionArgument()
TT = a - b
'## Chr (45) = Asc (-) Minus Sign ##
MathSign = Chr(45)
End Sub
'## Sub[6] ##
Sub MultiplicationArgument()
TT = a * b
'## Chr (120) = Asc (x) Multiply Sign ##
MathSign = Chr(120)
End Sub
Private Sub RandomArgument_Click(sender As Object, e As EventArgs) Handles Button4.Click
'## Formulation Mathematical Argument Testing ##
'## If... Test ... Then... Else... Statements ---------- ##
Answer = AnswerBox.Text
If Answer = TT Then
LbCorrect.Text = Correct
Else
LbIncorrect.Text = Incorrect
End If
'## Value of TT Assigned to LbAnswer.Text ##
LbAnswer.Text = TT
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Form89.Show()
Me.Hide()
End Sub
Private Sub InitialClear_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'## Clear Labelling Content at Startup Procedure ##
'## Clear Numeric Variables to Zero ------------ ##
'## Clear AlhpaNumberic Variables to Null String ##
LbRandoma.Text = ""
LbRandomb.Text = ""
MathSign = ""
Sign.Text = ""
AnswerBox.Text = ""
LbAnswer.Text = ""
LbCorrect.Text = ""
LbIncorrect.Text = ""
End Sub
Private Sub ClearValues_Click(sender As Object, e As EventArgs) Handles Button5.Click
'## Clear Numeric Variables to Zero ------------ ##
'## Clear AlhpaNumberic Variables to Null String ##
a = 0
b = 0
TT = 0
Answer = 0
LbRandoma.Text = ""
LbRandomb.Text = ""
MathSign = ""
Sign.Text = ""
AnswerBox.Text = ""
LbAnswer.Text = ""
LbCorrect.Text = ""
LbIncorrect.Text = ""
End Sub
End Class