Post: Visual basics Assignment
08-04-2017, 07:31 PM #1
Best Mate
Dark Knight
(adsbygoogle = window.adsbygoogle || []).push({}); Private Sub btnCheck_Click(sender As Object, e As EventArgs) Handles btnCheck.Click
Dim userAnswer As Integer = 0
If Integer.TryParse(txtAnswer.Text, userAnswer) Then
'Checking the answer and assign the color to
'feedback.
If answer = userAnswer Then
lblFeedback.ForeColor = Color.Green
lblFeedback.Text = "Correct answer!"
Else
lblFeedback.ForeColor = Color.Red
lblFeedback.Text = "Sorry, but the answer should have been " & answer.ToString
End If
Else
lblFeedback.ForeColor = Color.Red
lblFeedback.Text = "Please enter a valid integer."
End If
End Sub
![How it is suppose to look](You must login or register to view this content.)
Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click
'Variable for random integers
Dim rand As New Random
txtAnswer.Clear()
lblFeedback.Text = ""
Dim op1 As Integer = rand.Next(MAXRANGE) + MINVAL
Dim op2 As Integer = rand.Next(MAXRANGE) + MINVAL
'Answer for addition
If radAddition.Checked Then
lblProblem.Text = op1.ToString & " + " & op2.ToString & " = "
answer = op1 + op2
txtAnswer.Text = answer
'Answer for subtraction
ElseIf radSubtraction.Checked Then
lblProblem.Text = op1.ToString & " - " & op2.ToString & " = "
answer = op1 - op2
txtAnswer.Text = answer
'Answer for multiplication
ElseIf radMultiplication.Checked Then
'Adjust the sizes
op1 = op1 \ 2
op2 = op2 \ 2
lblProblem.Text = op1.ToString & " * " & op2.ToString & " = "
answer = op1 * op2
txtAnswer.Text = answer
'Answer for division
ElseIf radDivision.Checked Then
'Adjust so the quotient is always even
Do
op2 = rand.Next(50) + 1
Loop Until op1 Mod op2 = 0 And op2 < op1
lblProblem.Text = op1.ToString & " / " & op2.ToString & " = "
answer = op1 \ op2
txtAnswer.Text = answer
End If
'Awesome faceisplay the message
Label1.Text = "Please type in your answer to the following math problem. Integer answers only:"
End Sub
![How it should work and look](You must login or register to view this content.)

The things I need:
There should also be an exit button that ends the program, BUT before doing so, it displays in a MessageBox, the number of correct, incorrect and total number of problems attempted. To accomplish this, you will need two form level variables. Each time the 'Chek your answer' button is clicked adjust the values in these variables. The total number of problems attempted is the sum of these variables. It may be convenient to create a msg varianble of type String which has the statistics stored in it and then use it as an argument to MessageBox.Show.
01-10-2024, 10:08 AM #2
I must mention that after finding your posts on Google, I'm rather impressed with the content. They are written in such an interesting way and are thought-provoking and educational. It is absolutely admirable how willing you are to offer your knowledge and ideas. I want to thank you for your commitment to share your knowledge with all of us since I really believe that information is the key to realizing our greatest potential. For further high-quality articles, I strongly suggestYou must login or register to view this content. It features a vast array of intelligent and instructive articles covering a range of subjects.
01-19-2024, 11:32 AM #3
I thought managing work and studies was an impossible juggling act until I found Global Assignment Help. Their You must login or register to view this content. not only eased my workload but also honed my understanding of complex topics. Their dedication to authenticity and comprehensive research was evident in every assignment." - George Cameron, Stanford University

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo