top of page

Random Mathematics

1. Right Click on Graphics Image : Then Press Save Image as to Folder

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 Form49.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 [Case, SelectCase] 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.

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

Visual Basic 2013 Adobe-86.jpg

Public Class Form55

    Dim Random, Entry1, Entry2, EntryVal, CaseSelect, Answer As Integer


    Dim Correct, Incorrect, Cycle As Integer


    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click

        Form49.Show()
        Me.Hide()

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Random = TextBox1.Text

        Entry1 = (Random * Rnd() + 1)
        Entry2 = (Random * Rnd() + 1)

        CaseSelect = TextBox2.Text

        Select Case CaseSelect        'Select Case : CaseSelect Variable

            Case Is = 1               'Case Select = 1
                EntryVal = (Entry1 + Entry2)
               
Label1.Text = Entry1 & " + " & Entry2

            Case Is = 2               'Case Select = 2
                EntryVal = (Entry1 - Entry2)
               
Label1.Text = Entry1 & " - " & Entry2

            Case Is = 3               'Case Select = 3
                EntryVal = (Entry1 * Entry2)
               
Label1.Text = Entry1 & " x " & Entry2

            Case Is = 4               'Case Select = 4
                EntryVal = (Entry1 / Entry2)
               
Label1.Text = Entry1 & " / " & Entry2

            Case Else
                Label1.Text = " Enter No. 1 to 4 "

        End Select


    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Cycle = (Cycle + 1) : Label2.Text = Cycle

        Answer = TextBox3.Text

        If Answer = EntryVal Then
            Correct = (Correct + 1) :
Label3.Text = Correct
        Else : Incorrect = (Incorrect + 1) :
Label4.Text = Incorrect

        End If


    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        TextBox3.Text = ""
       
Label1.Text = ""

    End Sub


End Class

bottom of page