Shane Partridge
Visual Basic 2013
OOP Language - Random Mathematical Argumentation.
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 Image : Then Press Save Image as to Folder
- The Graphics 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.
5. Download Graphic Image below from allocated Folder.
In Private Sub Button_4 if only 1 Form is being used.
Terminate Form41.Show()
Me.Hide()
Then add End ' To Terminate Program.
Follow and Insert the TextBox, LabelBox and Button Controls from ToolBox
and allocate them on the Graphics.
The Program select a Random Limit Value for Arithmetic Calculus.
The Program uses the [If... Test... Then Statement] Criteria for Arithmetic Selection of
Mathematical Operators [+, -, x, /].
The Program correlates the No. of Correct & Incorrect Arguments that are Calculated
by the Answer that is entered in TextBox3.
Enter separate Random Values into TextBox1 & TextBox2 for Calculus.
Enter [ +, -, x, / ] for Arithmetic Selection of Mathematical Operators
Then press Button1 to execute the Random Mathematical Argument.
The Program checks the ASC(Code) of the Mathematical Operators for
Selection by the [If... Test... Then Statements]
Button1 initiates the Random Calculus.
Label1 - Displays the Random Argumentation and the Allocated Mathematical Operator
to be used for the computational Sum.
Button2 tests the entries that are entered in TextBox3.
Note - After each Test Press Button3 to Clear Variables
Then press Button1 to initiate next set of Random Arguments for Calculus
Public Class Form47
'Publicly Declare Variables for Multiply Sub Routine Access.
Dim Random1, Random2 As Integer
Dim RandNum1, RandNum2 As Integer
Dim Character As String
Dim Answer As Single
Dim Correct, Wrong As Integer
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Form41.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Random1 = TextBox1.Text
Random2 = TextBox2.Text
Character = TextBox3.Text
RandNum1 = (Random1 * Rnd() + 1) 'Assign Variable to eliminate Decimal Place
RandNum2 = (Random2 * Rnd() + 1) 'Assign Variable to eliminate Decimal Place
Label1.Text = RandNum1 & " " & Character & " " & RandNum2 & " = "
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If Character = Chr(43) Then 'ASC(Character) = [ + ]
Answer = (RandNum1 + RandNum2)
If TextBox4.Text = Answer Then
Correct = (Correct + 1) : Label2.Text = Correct
Else : Wrong = (Wrong + 1) : Label4.Text = " Incorrect Answer = " & Answer
Label3.Text = Wrong
End If
ElseIf Character = Chr(45) Then 'ASC(Character) = [ - ]
Answer = (RandNum1 - RandNum2)
If TextBox4.Text = Answer Then
Correct = (Correct + 1) : Label2.Text = Correct
Else : Wrong = (Wrong + 1) : Label4.Text = " Incorrect Answer = " & Answer
Label3.Text = Wrong
End If
ElseIf Character = Chr(47) Then 'ASC(Character) = [ / ]
Answer = (RandNum1 / RandNum2)
If TextBox4.Text = Answer Then
Correct = (Correct + 1) : Label2.Text = Correct
Else : Wrong = (Wrong + 1) : Label4.Text = " Incorrect Answer = " & Answer
Label3.Text = Wrong
End If
ElseIf Character = Chr(120) Then 'ASC(Character) = [ x ]
Answer = (RandNum1 * RandNum2)
If TextBox4.Text = Answer Then
Correct = (Correct + 1) : Label2.Text = Correct
Else : Wrong = (Wrong + 1) : Label4.Text = " Incorrect Answer = " & Answer
Label3.Text = Wrong
End If
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TextBox4.Text = ""
Label1.Text = ""
Label4.Text = ""
End Sub
End Class