I need to create an application that displays math problems by randomly generating two numbers, 1 through 10, and an operator (*, -, /, +) and prompts the user for an answer. The application should check the answer and display a message, display the correct answer and generate a new problem.(High school programing)
But Iam having problems on how to do the second operator. This is how did the first B,

]Dim rnd As New System.Random
    Private Sub btnProblem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProblem.Click
        'Purpose-  to Create an application math problems by randomly generating 2 numbers , 1-10 & operators (/*-+)& prompts the user for an answer
        'Input- the answer
        'output- the problem, a prompt telling the user whether he is right & the answer
        

        Dim t As Integer
        Dim y As Integer


        Dim answer As Integer
        Dim guess As Integer


        If Me.lbl2.Text = "+" Then

        End If


        y = rnd.Next(10)
        t = rnd.Next(10)
        Me.lblR.Text = y
        Me.lblt.Text = t
        Me.lbl2.Text = "+"
        guess = Me.txtanswer.Text
        answer = t + y

    Private Sub btnchecck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnchecck.Click
        Dim t As Integer
        Dim y As Integer


        Dim guess As Integer
        Dim answer As String
        y = rnd.Next(10)
        t = rnd.Next(10)
        Me.lblR.Text = y
        Me.lblt.Text = t
        Me.lbl2.Text = "+"
        guess = Me.txtanswer.Text
        answer = t + y
        If guess = answer Then
            Me.lblanswercheck.Text = " The answer is correct"
        Else
            Me.lblanswercheck.Text = " The answer is wrong"

    Private Sub btnAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswer.Click
        Dim t As Integer
        Dim y As Integer


        Dim guess As Integer
        Dim answer As String
        y = rnd.Next(10)
        t = rnd.Next(10)
        Me.lblR.Text = y
        Me.lblt.Text = t
        Me.lbl2.Text = "+"
        guess = Me.txtanswer.Text
        answer = t + y
        If guess = answer Then
            Me.lblanswercheck.Text = "the answer is coorect"
        Else
            Me.lblanswercheck.Text = " The  answer is " & answer

        End If
    End Sub
End Class

Edited 6 Years Ago by peter_budo: Do not play with text styling. Highlight only section of question, not everything

I don't understand at all what you wanna do. I don't understand the code either.
Anyway, I'll try to help.
First, I'm surprising that you haven't wrote no "end sub" instruction. Maybe there's some things that I don't know yet. The second thing is the first "If..." because it's empty. When you write code in an event (for example, in a "Click" event) you have to finish that with an "End Sub" instruction, for each event. That means that when you wrote, for example, Private Sub btnchecck_Click(), you haven't finish the event with the corresponding instruction and you pass to the next event, and the code is disordered. I'm sorry if I'm wrong, but I've never seen anything like this before.
I think that the best way to create the operators is with a "select...case". I mean...

Dim number1, number2 As Integer
Dim operation, result As Integer

Public Function dooperations()
Select Case operation
Case Is = 1
Label1.Caption = "+"
result = number1 + number2
Case Is = 2
Label1.Caption = "-"
result = number1 - number2
Case Is = 3
Label1.Caption = "*"
result = number1 * number2
Case Is = 4
Label1.Caption = "/"
result = number1 / number2
End Select
End Function

Public Function gen_numbers()
Randomize
number1 = CInt((10 * rnd) + 1)
Text1 = number1
Randomize
number2 = CInt((10 * rnd) + 1)
Text2 = number2
End Function

Private Sub answer_Click()
Call dooperations
MsgBox result
Text1 = ""
Text2 = ""
Label1.Caption = "Operation"
End Sub

Private Sub Form_Load()
Text1.Locked = True
Text2.Locked = True
MsgBox "killbill07@hotmail.es"
End Sub

Public Function gen_operation()
Randomize
operation = CInt((4 * rnd) + 1)
End Function

Private Sub make_problem_Click()
Call gen_numbers
Call gen_operation
End Sub

I did the entire program for you, I'm uploading it now. I'll post it here soon.

This question has already been answered. Start a new discussion instead.