Public Class MathForm Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Friend WithEvents Num1Label As System.Windows.Forms.Label Friend WithEvents Num2Label As System.Windows.Forms.Label Friend WithEvents OperatorPictureBox As System.Windows.Forms.PictureBox Friend WithEvents EqualPictureBox As System.Windows.Forms.PictureBox Friend WithEvents ProblemGroupBox As System.Windows.Forms.GroupBox Friend WithEvents AnswerTextBox As System.Windows.Forms.TextBox Friend WithEvents OperationGroupBox As System.Windows.Forms.GroupBox Friend WithEvents AdditionRadioButton As System.Windows.Forms.RadioButton Friend WithEvents IdCorrectLabel As System.Windows.Forms.Label Friend WithEvents IdIncorrectLabel As System.Windows.Forms.Label Friend WithEvents CorrectLabel As System.Windows.Forms.Label Friend WithEvents IncorrectLabel As System.Windows.Forms.Label Friend WithEvents ExitButton As System.Windows.Forms.Button Friend WithEvents SummaryGroupBox As System.Windows.Forms.GroupBox Friend WithEvents AnswerPictureBox As System.Windows.Forms.PictureBox Friend WithEvents PlusPictureBox As System.Windows.Forms.PictureBox Friend WithEvents MinusPictureBox As System.Windows.Forms.PictureBox Friend WithEvents CheckAnswerButton As System.Windows.Forms.Button Friend WithEvents HappyPictureBox As System.Windows.Forms.PictureBox Friend WithEvents NeutralPictureBox As System.Windows.Forms.PictureBox Friend WithEvents Grade2RadioButton As System.Windows.Forms.RadioButton Friend WithEvents GradeGroupBox As System.Windows.Forms.GroupBox Friend WithEvents Grade1RadioButton As System.Windows.Forms.RadioButton Friend WithEvents SubtractionRadioButton As System.Windows.Forms.RadioButton Friend WithEvents SummaryCheckBox As System.Windows.Forms.CheckBox 'Required by the Windows Form Designer Private components As System.ComponentModel.Container 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox Friend WithEvents PictureBoxSmile As System.Windows.Forms.PictureBox Friend WithEvents PictureBoxSerio As System.Windows.Forms.PictureBox Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(MathForm)) Me.IdCorrectLabel = New System.Windows.Forms.Label Me.SummaryCheckBox = New System.Windows.Forms.CheckBox Me.PlusPictureBox = New System.Windows.Forms.PictureBox Me.OperatorPictureBox = New System.Windows.Forms.PictureBox Me.OperationGroupBox = New System.Windows.Forms.GroupBox Me.SubtractionRadioButton = New System.Windows.Forms.RadioButton Me.AdditionRadioButton = New System.Windows.Forms.RadioButton Me.Num2Label = New System.Windows.Forms.Label Me.AnswerTextBox = New System.Windows.Forms.TextBox Me.EqualPictureBox = New System.Windows.Forms.PictureBox Me.SummaryGroupBox = New System.Windows.Forms.GroupBox Me.CorrectLabel = New System.Windows.Forms.Label Me.IdIncorrectLabel = New System.Windows.Forms.Label Me.IncorrectLabel = New System.Windows.Forms.Label Me.ProblemGroupBox = New System.Windows.Forms.GroupBox Me.PictureBoxSerio = New System.Windows.Forms.PictureBox Me.PictureBoxSmile = New System.Windows.Forms.PictureBox Me.PictureBox2 = New System.Windows.Forms.PictureBox Me.PictureBox1 = New System.Windows.Forms.PictureBox Me.AnswerPictureBox = New System.Windows.Forms.PictureBox Me.ExitButton = New System.Windows.Forms.Button Me.Num1Label = New System.Windows.Forms.Label Me.CheckAnswerButton = New System.Windows.Forms.Button Me.GradeGroupBox = New System.Windows.Forms.GroupBox Me.Grade1RadioButton = New System.Windows.Forms.RadioButton Me.Grade2RadioButton = New System.Windows.Forms.RadioButton Me.MinusPictureBox = New System.Windows.Forms.PictureBox Me.NeutralPictureBox = New System.Windows.Forms.PictureBox Me.HappyPictureBox = New System.Windows.Forms.PictureBox Me.OperationGroupBox.SuspendLayout() Me.SummaryGroupBox.SuspendLayout() Me.ProblemGroupBox.SuspendLayout() Me.GradeGroupBox.SuspendLayout() Me.SuspendLayout() ' 'IdCorrectLabel ' Me.IdCorrectLabel.AutoSize = True Me.IdCorrectLabel.Location = New System.Drawing.Point(8, 16) Me.IdCorrectLabel.Name = "IdCorrectLabel" Me.IdCorrectLabel.Size = New System.Drawing.Size(52, 19) Me.IdCorrectLabel.TabIndex = 0 Me.IdCorrectLabel.Text = "Correct:" ' 'SummaryCheckBox ' Me.SummaryCheckBox.Location = New System.Drawing.Point(352, 144) Me.SummaryCheckBox.Name = "SummaryCheckBox" Me.SummaryCheckBox.Size = New System.Drawing.Size(136, 32) Me.SummaryCheckBox.TabIndex = 3 Me.SummaryCheckBox.Text = "&Display summary" ' 'PlusPictureBox ' Me.PlusPictureBox.Location = New System.Drawing.Point(24, 272) Me.PlusPictureBox.Name = "PlusPictureBox" Me.PlusPictureBox.Size = New System.Drawing.Size(16, 16) Me.PlusPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.PlusPictureBox.TabIndex = 5 Me.PlusPictureBox.TabStop = False Me.PlusPictureBox.Visible = False ' 'OperatorPictureBox ' Me.OperatorPictureBox.Location = New System.Drawing.Point(66, 31) Me.OperatorPictureBox.Name = "OperatorPictureBox" Me.OperatorPictureBox.Size = New System.Drawing.Size(23, 27) Me.OperatorPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.OperatorPictureBox.TabIndex = 5 Me.OperatorPictureBox.TabStop = False ' 'OperationGroupBox ' Me.OperationGroupBox.Controls.Add(Me.SubtractionRadioButton) Me.OperationGroupBox.Controls.Add(Me.AdditionRadioButton) Me.OperationGroupBox.Location = New System.Drawing.Point(192, 152) Me.OperationGroupBox.Name = "OperationGroupBox" Me.OperationGroupBox.Size = New System.Drawing.Size(112, 100) Me.OperationGroupBox.TabIndex = 2 Me.OperationGroupBox.TabStop = False Me.OperationGroupBox.Text = "Operation" ' 'SubtractionRadioButton ' Me.SubtractionRadioButton.Location = New System.Drawing.Point(8, 59) Me.SubtractionRadioButton.Name = "SubtractionRadioButton" Me.SubtractionRadioButton.Size = New System.Drawing.Size(96, 24) Me.SubtractionRadioButton.TabIndex = 1 Me.SubtractionRadioButton.Text = "&Subtraction" ' 'AdditionRadioButton ' Me.AdditionRadioButton.Checked = True Me.AdditionRadioButton.Location = New System.Drawing.Point(8, 27) Me.AdditionRadioButton.Name = "AdditionRadioButton" Me.AdditionRadioButton.Size = New System.Drawing.Size(96, 24) Me.AdditionRadioButton.TabIndex = 0 Me.AdditionRadioButton.TabStop = True Me.AdditionRadioButton.Text = "&Addition" ' 'Num2Label ' Me.Num2Label.BackColor = System.Drawing.Color.White Me.Num2Label.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Num2Label.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Num2Label.Location = New System.Drawing.Point(103, 32) Me.Num2Label.Name = "Num2Label" Me.Num2Label.Size = New System.Drawing.Size(40, 23) Me.Num2Label.TabIndex = 1 Me.Num2Label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'AnswerTextBox ' Me.AnswerTextBox.AutoSize = False Me.AnswerTextBox.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(255, Byte), CType(192, Byte)) Me.AnswerTextBox.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.AnswerTextBox.Location = New System.Drawing.Point(199, 32) Me.AnswerTextBox.Name = "AnswerTextBox" Me.AnswerTextBox.Size = New System.Drawing.Size(40, 23) Me.AnswerTextBox.TabIndex = 0 Me.AnswerTextBox.Text = "" ' 'EqualPictureBox ' Me.EqualPictureBox.Image = CType(resources.GetObject("EqualPictureBox.Image"), System.Drawing.Image) Me.EqualPictureBox.Location = New System.Drawing.Point(160, 32) Me.EqualPictureBox.Name = "EqualPictureBox" Me.EqualPictureBox.Size = New System.Drawing.Size(23, 21) Me.EqualPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.EqualPictureBox.TabIndex = 5 Me.EqualPictureBox.TabStop = False ' 'SummaryGroupBox ' Me.SummaryGroupBox.Controls.Add(Me.CorrectLabel) Me.SummaryGroupBox.Controls.Add(Me.IdCorrectLabel) Me.SummaryGroupBox.Controls.Add(Me.IdIncorrectLabel) Me.SummaryGroupBox.Controls.Add(Me.IncorrectLabel) Me.SummaryGroupBox.Location = New System.Drawing.Point(352, 168) Me.SummaryGroupBox.Name = "SummaryGroupBox" Me.SummaryGroupBox.Size = New System.Drawing.Size(144, 79) Me.SummaryGroupBox.TabIndex = 4 Me.SummaryGroupBox.TabStop = False Me.SummaryGroupBox.Visible = False ' 'CorrectLabel ' Me.CorrectLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.CorrectLabel.Location = New System.Drawing.Point(11, 40) Me.CorrectLabel.Name = "CorrectLabel" Me.CorrectLabel.Size = New System.Drawing.Size(48, 23) Me.CorrectLabel.TabIndex = 1 Me.CorrectLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'IdIncorrectLabel ' Me.IdIncorrectLabel.AutoSize = True Me.IdIncorrectLabel.Location = New System.Drawing.Point(72, 16) Me.IdIncorrectLabel.Name = "IdIncorrectLabel" Me.IdIncorrectLabel.Size = New System.Drawing.Size(63, 19) Me.IdIncorrectLabel.TabIndex = 2 Me.IdIncorrectLabel.Text = "Incorrect:" ' 'IncorrectLabel ' Me.IncorrectLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.IncorrectLabel.Location = New System.Drawing.Point(75, 40) Me.IncorrectLabel.Name = "IncorrectLabel" Me.IncorrectLabel.Size = New System.Drawing.Size(48, 23) Me.IncorrectLabel.TabIndex = 3 Me.IncorrectLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'ProblemGroupBox ' Me.ProblemGroupBox.Controls.Add(Me.PictureBoxSerio) Me.ProblemGroupBox.Controls.Add(Me.PictureBoxSmile) Me.ProblemGroupBox.Controls.Add(Me.PictureBox2) Me.ProblemGroupBox.Controls.Add(Me.PictureBox1) Me.ProblemGroupBox.Controls.Add(Me.AnswerPictureBox) Me.ProblemGroupBox.Controls.Add(Me.ExitButton) Me.ProblemGroupBox.Controls.Add(Me.AnswerTextBox) Me.ProblemGroupBox.Controls.Add(Me.Num1Label) Me.ProblemGroupBox.Controls.Add(Me.Num2Label) Me.ProblemGroupBox.Controls.Add(Me.OperatorPictureBox) Me.ProblemGroupBox.Controls.Add(Me.EqualPictureBox) Me.ProblemGroupBox.Controls.Add(Me.CheckAnswerButton) Me.ProblemGroupBox.Location = New System.Drawing.Point(24, 24) Me.ProblemGroupBox.Name = "ProblemGroupBox" Me.ProblemGroupBox.Size = New System.Drawing.Size(472, 104) Me.ProblemGroupBox.TabIndex = 0 Me.ProblemGroupBox.TabStop = False ' 'PictureBoxSerio ' Me.PictureBoxSerio.Image = CType(resources.GetObject("PictureBoxSerio.Image"), System.Drawing.Image) Me.PictureBoxSerio.Location = New System.Drawing.Point(280, 56) Me.PictureBoxSerio.Name = "PictureBoxSerio" Me.PictureBoxSerio.Size = New System.Drawing.Size(40, 40) Me.PictureBoxSerio.TabIndex = 11 Me.PictureBoxSerio.TabStop = False Me.PictureBoxSerio.Visible = False ' 'PictureBoxSmile ' Me.PictureBoxSmile.Image = CType(resources.GetObject("PictureBoxSmile.Image"), System.Drawing.Image) Me.PictureBoxSmile.Location = New System.Drawing.Point(232, 56) Me.PictureBoxSmile.Name = "PictureBoxSmile" Me.PictureBoxSmile.Size = New System.Drawing.Size(40, 40) Me.PictureBoxSmile.TabIndex = 10 Me.PictureBoxSmile.TabStop = False Me.PictureBoxSmile.Visible = False ' 'PictureBox2 ' Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Image) Me.PictureBox2.Location = New System.Drawing.Point(96, 64) Me.PictureBox2.Name = "PictureBox2" Me.PictureBox2.Size = New System.Drawing.Size(24, 24) Me.PictureBox2.TabIndex = 9 Me.PictureBox2.TabStop = False Me.PictureBox2.Visible = False ' 'PictureBox1 ' Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image) Me.PictureBox1.Location = New System.Drawing.Point(32, 64) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(24, 24) Me.PictureBox1.TabIndex = 8 Me.PictureBox1.TabStop = False Me.PictureBox1.Visible = False ' 'AnswerPictureBox ' Me.AnswerPictureBox.Location = New System.Drawing.Point(256, 29) Me.AnswerPictureBox.Name = "AnswerPictureBox" Me.AnswerPictureBox.Size = New System.Drawing.Size(32, 32) Me.AnswerPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.AnswerPictureBox.TabIndex = 7 Me.AnswerPictureBox.TabStop = False ' 'ExitButton ' Me.ExitButton.Location = New System.Drawing.Point(336, 64) Me.ExitButton.Name = "ExitButton" Me.ExitButton.Size = New System.Drawing.Size(104, 23) Me.ExitButton.TabIndex = 4 Me.ExitButton.Text = "E&xit" ' 'Num1Label ' Me.Num1Label.BackColor = System.Drawing.Color.White Me.Num1Label.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Num1Label.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Num1Label.Location = New System.Drawing.Point(16, 32) Me.Num1Label.Name = "Num1Label" Me.Num1Label.Size = New System.Drawing.Size(40, 23) Me.Num1Label.TabIndex = 2 Me.Num1Label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' 'CheckAnswerButton ' Me.CheckAnswerButton.Location = New System.Drawing.Point(336, 32) Me.CheckAnswerButton.Name = "CheckAnswerButton" Me.CheckAnswerButton.Size = New System.Drawing.Size(104, 23) Me.CheckAnswerButton.TabIndex = 3 Me.CheckAnswerButton.Text = "&Check Answer" ' 'GradeGroupBox ' Me.GradeGroupBox.Controls.Add(Me.Grade1RadioButton) Me.GradeGroupBox.Controls.Add(Me.Grade2RadioButton) Me.GradeGroupBox.Location = New System.Drawing.Point(24, 152) Me.GradeGroupBox.Name = "GradeGroupBox" Me.GradeGroupBox.Size = New System.Drawing.Size(152, 100) Me.GradeGroupBox.TabIndex = 1 Me.GradeGroupBox.TabStop = False Me.GradeGroupBox.Text = "Grade" ' 'Grade1RadioButton ' Me.Grade1RadioButton.Checked = True Me.Grade1RadioButton.Location = New System.Drawing.Point(8, 27) Me.Grade1RadioButton.Name = "Grade1RadioButton" Me.Grade1RadioButton.Size = New System.Drawing.Size(136, 24) Me.Grade1RadioButton.TabIndex = 0 Me.Grade1RadioButton.TabStop = True Me.Grade1RadioButton.Text = "Grade &1 (1-10)" ' 'Grade2RadioButton ' Me.Grade2RadioButton.Location = New System.Drawing.Point(8, 59) Me.Grade2RadioButton.Name = "Grade2RadioButton" Me.Grade2RadioButton.Size = New System.Drawing.Size(136, 24) Me.Grade2RadioButton.TabIndex = 1 Me.Grade2RadioButton.Text = "Grade &2 (10-99)" ' 'MinusPictureBox ' Me.MinusPictureBox.Location = New System.Drawing.Point(48, 272) Me.MinusPictureBox.Name = "MinusPictureBox" Me.MinusPictureBox.Size = New System.Drawing.Size(16, 16) Me.MinusPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.MinusPictureBox.TabIndex = 5 Me.MinusPictureBox.TabStop = False Me.MinusPictureBox.Visible = False ' 'NeutralPictureBox ' Me.NeutralPictureBox.Location = New System.Drawing.Point(120, 264) Me.NeutralPictureBox.Name = "NeutralPictureBox" Me.NeutralPictureBox.Size = New System.Drawing.Size(32, 32) Me.NeutralPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.NeutralPictureBox.TabIndex = 7 Me.NeutralPictureBox.TabStop = False Me.NeutralPictureBox.Visible = False ' 'HappyPictureBox ' Me.HappyPictureBox.Location = New System.Drawing.Point(80, 264) Me.HappyPictureBox.Name = "HappyPictureBox" Me.HappyPictureBox.Size = New System.Drawing.Size(32, 32) Me.HappyPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.HappyPictureBox.TabIndex = 7 Me.HappyPictureBox.TabStop = False Me.HappyPictureBox.Visible = False ' 'MathForm ' Me.AcceptButton = Me.CheckAnswerButton Me.AutoScaleBaseSize = New System.Drawing.Size(6, 16) Me.ClientSize = New System.Drawing.Size(520, 301) Me.Controls.Add(Me.NeutralPictureBox) Me.Controls.Add(Me.HappyPictureBox) Me.Controls.Add(Me.MinusPictureBox) Me.Controls.Add(Me.PlusPictureBox) Me.Controls.Add(Me.SummaryGroupBox) Me.Controls.Add(Me.OperationGroupBox) Me.Controls.Add(Me.GradeGroupBox) Me.Controls.Add(Me.ProblemGroupBox) Me.Controls.Add(Me.SummaryCheckBox) Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.MaximizeBox = False Me.Name = "MathForm" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Math Practice" Me.OperationGroupBox.ResumeLayout(False) Me.SummaryGroupBox.ResumeLayout(False) Me.ProblemGroupBox.ResumeLayout(False) Me.GradeGroupBox.ResumeLayout(False) Me.ResumeLayout(False) End Sub #End Region Private Sub ExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitButton.Click Me.Close() End Sub Private Sub MathForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Starting with Grade 1 and Addition Me.OperatorPictureBox.Image() = Me.PictureBox2.Image Call generate() End Sub Private Sub CheckAnswerButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckAnswerButton.Click ' Event Click on the CheckAnswer Button 'If the Answer is correct show proper Message and generate new # 'If Incorrect show proper Message and allow user to retry Dim a, b, c As Integer 'Will use for the Numbers and the Answer Static correct, incorrect As Integer 'Counters for the Summary If IsNumeric(Me.AnswerTextBox.Text) Then 'MaKe Sure the Value entered it's Numeric a = Me.Num1Label.Text b = Me.Num2Label.Text c = Me.AnswerTextBox.Text If Me.SubtractionRadioButton.Checked = True Then 'Check if it's a substraction or adition If a - b = c Then 'Check if it's correct the Substraction Me.AnswerPictureBox.Image() = Me.PictureBoxSmile.Image MsgBox(" You are Correct", MsgBoxStyle.Exclamation, " Congratulations ") correct += 1 'Increment Correct Counter Call generate() Else Me.AnswerPictureBox.Image() = Me.PictureBoxSerio.Image MsgBox(" Sorry You are NOT Correct", MsgBoxStyle.Critical, " Try Again ...") Me.AnswerTextBox.SelectAll() incorrect += 1 'Increment Incorrect Counter End If Else ' Not a Substraction then it's an Addition If a + b = c Then 'Check if it's correct the Addition Me.AnswerPictureBox.Image() = Me.PictureBoxSmile.Image MsgBox(" You are Correct", MsgBoxStyle.Exclamation, " Congratulations ") correct += 1 'Increment Correct Counter Call generate() Else ' Me.AnswerPictureBox.Image() = Me.PictureBoxSerio.Image MsgBox(" Sorry You are NOT Correct", MsgBoxStyle.Critical, " Try Again ...") Me.AnswerTextBox.SelectAll() incorrect += 1 'Increment Incorrect Counter End If End If Else 'Value entered it's NOT Numeric MsgBox(" Sorry the Value is not Numeric", MsgBoxStyle.Information, " Message") Me.AnswerTextBox.Text = "" End If Me.IncorrectLabel.Text = incorrect Me.CorrectLabel.Text = correct Me.AnswerTextBox.Focus() End Sub Private Sub SummaryCheckBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SummaryCheckBox.Click ' Event Click on the Summary CheckBox 'If it's checked show Summary 'NOT checked do NOT show Summary If Me.SummaryCheckBox.Checked = True Then Me.SummaryGroupBox.Visible = True Else Me.SummaryGroupBox.Visible = False End If Me.AnswerTextBox.Focus() End Sub Private Sub Grade2RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Grade2RadioButton.CheckedChanged Call generate() End Sub Private Sub SubtractionRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubtractionRadioButton.CheckedChanged ' Event CheckedChanged on the Subtraction RadioButton 'in the case of Subtraction show the proper image (Minus Symbol) 'and check for a negative answer If Me.SubtractionRadioButton.Checked = True Then Me.OperatorPictureBox.Image() = Me.PictureBox1.Image Call CheckSubs() Else Me.OperatorPictureBox.Image() = Me.PictureBox2.Image End If Me.AnswerTextBox.Focus() End Sub Private Sub generate() ' generate function 'will check for the proper grade 'and generate the random Numbers If Me.Grade2RadioButton.Checked = True Then Me.Num1Label.Text = CInt(Int((90 * Rnd()) + 10)) Me.Num2Label.Text = CInt(Int((90 * Rnd()) + 10)) Call CheckSubs() Else Me.Num1Label.Text = CInt(Int((10 * Rnd()) + 1)) Me.Num2Label.Text = CInt(Int((10 * Rnd()) + 1)) Call CheckSubs() End If Me.AnswerTextBox.Text = "" Me.AnswerTextBox.Focus() End Sub Private Sub CheckSubs() ' CheckSubs function 'In case of the substration avoid 'a negative answer swaping the # Dim a, b As Integer a = Me.Num1Label.Text b = Me.Num2Label.Text If Me.SubtractionRadioButton.Checked = True Then If a < b Then Me.Num1Label.Text = b Me.Num2Label.Text = a End If End If End Sub End Class