5 Replies - 444 Views - Last Post: 18 October 2013 - 06:06 AM Rate Topic: -----

#1 lyndalocks  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 57
  • Joined: 23-September 13

I am done with writing the code. Error at beginning at Public class...

Posted 15 October 2013 - 10:41 PM

I am done with my coding, the only thing is that at the top where it starts off with public class, it is displaying an error that it is missing the End class. so if i install an end class, then a lot of errors come out on the events with jiggly lines. please help!!!!

Code:
Public Class mathtutor


    Dim myRandom As New Random
    Dim a As Integer = myRandom.Next(1, 11)
    Dim b As Integer = myRandom.Next(1, 11)
    Dim x As Integer = a * b
    Dim y As Integer = a + b
    Dim read As String


    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles clearbutton.Click
        tutorbox.Text = String.Empty
        feedbacktext.Text = String.Empty
        userans.Text = String.Empty

        a = myRandom.Next(1, 11)
        b = myRandom.Next(1, 11)
        x = a * b
        y = a + b

    End Sub

    Private Sub tutorbox_TextChanged(sender As Object, e As EventArgs) Handles tutorbox.TextChanged

    End Sub

    Private Sub userans_TextChanged(sender As Object, e As EventArgs) Handles userans.TextChanged

    End Sub

    Private Sub startbutton_Click(sender As Object, e As EventArgs) Handles startbutton.Click
        multiplyradio.Enabled = True
        additionradio.Enabled = True

        If multiplyradio.Checked = False And additionradio.Checked = False Then
            MessageBox.Show("Please select either Multiplication or Addition to continue", "Maths Tutor")
        End If

        If multiplyradio.Checked = True Then
            tutorbox.Text = ("How much is " & a & "  times  " & B)/>/>
        End If

        If additionradio.Checked = True Then
            tutorbox.Text = ("How much is " & a & "  plus  " & B)/>/>
        End If
    End Sub


    Private Sub checkbutton_Click(sender As Object, e As EventArgs) Handles checkbutton.Click
        If userans.Text = String.Empty Then
            MessageBox.Show("Please type in your Answer", "Maths Tutor")
        End If

        If multiplyradio.Checked = True And userans.Text <> String.Empty Then
            userans.Text = MultiplySet()

        ElseIf additionradio.Checked = True And userans.Text <> String.Empty Then
            userans.Text = AddSet()
        End If

    End Sub
    'Multipliction
    Function MultiplySet() As String

        Dim correct(4) As String
        correct(0) = "Very good!"
        correct(1) = "Excellent!"
        correct(2) = "Nice Work!"
        correct(3) = "Keep up the good Work!"

        Dim wrong(4) As String
        wrong(0) = "No. Please try again"
        wrong(1) = "Wrong. Try once more"
        wrong(2) = " Not not quite,Don't give up!"
        wrong(3) = "No. Keep trying"

        Dim pqrngo As New Random

        If x = Val(userans.Text) Then
            read = correct(pqrngo.Next(correct.Count()))
        End If

        If x <> Val(userans.Text) Then
            read = wrong(pqrngo.Next(wrong.Count()))
        End If

        Return read

    End Function

    Function AddSet() As String
        Dim correct(4) As String
        correct(0) = "Very good!"
        correct(1) = "Excellent!"
        correct(2) = "Good Job!"
        correct(3) = "Terrific!"

        Dim wrong(4) As String
        wrong(0) = "Please try again"
        wrong(1) = "Give it another shot"
        wrong(2) = " Incorrect!"
        wrong(3) = "No. Keep trying"

        Dim pqrngo As New Random

        If Val(userans.Text) = y Then
            read = correct(pqrngo.Next(correct.Count()))
        End If

        If Val(userans.Text) <> y Then
            read = wrong(pqrngo.Next(wrong.Count()))
        End If

        Return read
    End Function


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles howbutton.Click
        MsgBox("The program starts with the user selecting one of two options multiplication or addition. Upon click of start, the system generates two random numbers in the range of 1-10 and poses a question appropiately, while storing the answer internally. User's response is checked against stored answer and a suitable message is given. A randomly picked suitable comment is appended to correct and wrong answer messages.", MsgBoxStyle.OkOnly, "How it Works!")
    End Sub

    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles multiplyradio.CheckedChanged
        feedbacktext.Clear()
        TextBox2.Clear()


    End Sub

    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles additionradio.CheckedChanged

    End Sub

    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles tutorbox.TextChanged
        Dim num1 As New Random
        Dim num2 As Integer

        If multiplyradio.Checked = True Then
            feedbacktext.Text = "How much is" & Val(num1) & "times" & Val(num2)

        Else
            additionradio.Checked = True
            feedbacktext.Text = Val(num1) + Val(num2)

        End If
    End Sub


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


    End Sub

Public Class mathtutor


    Dim myRandom As New Random
    Dim a As Integer = myRandom.Next(1, 11)
    Dim b As Integer = myRandom.Next(1, 11)
    Dim x As Integer = a * b
    Dim y As Integer = a + b
    Dim read As String


    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles clearbutton.Click
        tutorbox.Text = String.Empty
        feedbacktext.Text = String.Empty
        userans.Text = String.Empty

        a = myRandom.Next(1, 11)
        b = myRandom.Next(1, 11)
        x = a * b
        y = a + b

    End Sub

    Private Sub tutorbox_TextChanged(sender As Object, e As EventArgs) Handles tutorbox.TextChanged

    End Sub

    Private Sub userans_TextChanged(sender As Object, e As EventArgs) Handles userans.TextChanged

    End Sub

    Private Sub startbutton_Click(sender As Object, e As EventArgs) Handles startbutton.Click
        multiplyradio.Enabled = True
        additionradio.Enabled = True

        If multiplyradio.Checked = False And additionradio.Checked = False Then
            MessageBox.Show("Please select either Multiplication or Addition to continue", "Maths Tutor")
        End If

        If multiplyradio.Checked = True Then
            tutorbox.Text = ("How much is " & a & "  times  " & B)/>/>
        End If

        If additionradio.Checked = True Then
            tutorbox.Text = ("How much is " & a & "  plus  " & B)/>/>
        End If
    End Sub


    Private Sub checkbutton_Click(sender As Object, e As EventArgs) Handles checkbutton.Click
        If userans.Text = String.Empty Then
            MessageBox.Show("Please type in your Answer", "Maths Tutor")
        End If

        If multiplyradio.Checked = True And userans.Text <> String.Empty Then
            userans.Text = MultiplySet()

        ElseIf additionradio.Checked = True And userans.Text <> String.Empty Then
            userans.Text = AddSet()
        End If

    End Sub
    'Multipliction
    Function MultiplySet() As String

        Dim correct(4) As String
        correct(0) = "Very good!"
        correct(1) = "Excellent!"
        correct(2) = "Nice Work!"
        correct(3) = "Keep up the good Work!"

        Dim wrong(4) As String
        wrong(0) = "No. Please try again"
        wrong(1) = "Wrong. Try once more"
        wrong(2) = " Not not quite,Don't give up!"
        wrong(3) = "No. Keep trying"

        Dim pqrngo As New Random

        If x = Val(userans.Text) Then
            read = correct(pqrngo.Next(correct.Count()))
        End If

        If x <> Val(userans.Text) Then
            read = wrong(pqrngo.Next(wrong.Count()))
        End If

        Return read

    End Function

    Function AddSet() As String
        Dim correct(4) As String
        correct(0) = "Very good!"
        correct(1) = "Excellent!"
        correct(2) = "Good Job!"
        correct(3) = "Terrific!"

        Dim wrong(4) As String
        wrong(0) = "Please try again"
        wrong(1) = "Give it another shot"
        wrong(2) = " Incorrect!"
        wrong(3) = "No. Keep trying"

        Dim pqrngo As New Random

        If Val(userans.Text) = y Then
            read = correct(pqrngo.Next(correct.Count()))
        End If

        If Val(userans.Text) <> y Then
            read = wrong(pqrngo.Next(wrong.Count()))
        End If

        Return read
    End Function


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles howbutton.Click
        MsgBox("The program starts with the user selecting one of two options multiplication or addition. Upon click of start, the system generates two random numbers in the range of 1-10 and poses a question appropiately, while storing the answer internally. User's response is checked against stored answer and a suitable message is given. A randomly picked suitable comment is appended to correct and wrong answer messages.", MsgBoxStyle.OkOnly, "How it Works!")
    End Sub

    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles multiplyradio.CheckedChanged
        feedbacktext.Clear()
        TextBox2.Clear()


    End Sub

    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles additionradio.CheckedChanged

    End Sub

    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles tutorbox.TextChanged
        Dim num1 As New Random
        Dim num2 As Integer

        If multiplyradio.Checked = True Then
            feedbacktext.Text = "How much is" & Val(num1) & "times" & Val(num2)

        Else
            additionradio.Checked = True
            feedbacktext.Text = Val(num1) + Val(num2)

        End If
    End Sub


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


    End Sub


This post has been edited by AdamSpeight2008: 16 October 2013 - 12:10 AM
Reason for edit:: OP can't use code tags correctly


Is This A Good Question/Topic? 0
  • +

Replies To: I am done with writing the code. Error at beginning at Public class...

#2 ebolisa  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 143
  • Joined: 22-September 09

Re: I am done with writing the code. Error at beginning at Public class...

Posted 15 October 2013 - 11:36 PM

Your code checked ok in my VS2010. I didn’t run it though.
Public Class Form1

    Dim myRandom As New Random
    Dim a As Integer = myRandom.Next(1, 11)
    Dim b As Integer = myRandom.Next(1, 11)
    Dim x As Integer = a * b
    Dim y As Integer = a + b
    Dim read As String


    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles clearbutton.Click
        tutorbox.Text = String.Empty
        feedbacktext.Text = String.Empty
        userans.Text = String.Empty

        a = myRandom.Next(1, 11)
        b = myRandom.Next(1, 11)
        x = a * b
        y = a + b

    End Sub

    Private Sub tutorbox_TextChanged(sender As Object, e As EventArgs) Handles tutorbox.TextChanged

    End Sub

    Private Sub userans_TextChanged(sender As Object, e As EventArgs) Handles userans.TextChanged

    End Sub

    Private Sub startbutton_Click(sender As Object, e As EventArgs) Handles startbutton.Click
        multiplyradio.Enabled = True
        additionradio.Enabled = True

        If multiplyradio.Checked = False And additionradio.Checked = False Then
            MessageBox.Show("Please select either Multiplication or Addition to continue", "Maths Tutor")
        End If

        If multiplyradio.Checked = True Then
            tutorbox.Text = ("How much is " & a & " times " & B)/>/>/>/>
        End If

        If additionradio.Checked = True Then
            tutorbox.Text = ("How much is " & a & " plus " & B)/>/>/>/>
        End If
    End Sub


    Private Sub checkbutton_Click(sender As Object, e As EventArgs) Handles checkbutton.Click
        If userans.Text = String.Empty Then
            MessageBox.Show("Please type in your Answer", "Maths Tutor")
        End If

        If multiplyradio.Checked = True And userans.Text <> String.Empty Then
            userans.Text = MultiplySet()

        ElseIf additionradio.Checked = True And userans.Text <> String.Empty Then
            userans.Text = AddSet()
        End If

    End Sub
    'Multipliction
    Function MultiplySet() As String

        Dim correct(4) As String
        correct(0) = "Very good!"
        correct(1) = "Excellent!"
        correct(2) = "Nice Work!"
        correct(3) = "Keep up the good Work!"

        Dim wrong(4) As String
        wrong(0) = "No. Please try again"
        wrong(1) = "Wrong. Try once more"
        wrong(2) = " Not not quite,Don't give up!"
        wrong(3) = "No. Keep trying"

        Dim pqrngo As New Random

        If x = Val(userans.Text) Then
            read = correct(pqrngo.Next(correct.Count()))
        End If

        If x <> Val(userans.Text) Then
            read = wrong(pqrngo.Next(wrong.Count()))
        End If

        Return read

    End Function

    Function AddSet() As String
        Dim correct(4) As String
        correct(0) = "Very good!"
        correct(1) = "Excellent!"
        correct(2) = "Good Job!"
        correct(3) = "Terrific!"

        Dim wrong(4) As String
        wrong(0) = "Please try again"
        wrong(1) = "Give it another shot"
        wrong(2) = " Incorrect!"
        wrong(3) = "No. Keep trying"

        Dim pqrngo As New Random

        If Val(userans.Text) = y Then
            read = correct(pqrngo.Next(correct.Count()))
        End If

        If Val(userans.Text) <> y Then
            read = wrong(pqrngo.Next(wrong.Count()))
        End If

        Return read
    End Function


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles howbutton.Click
        MsgBox("The program starts with the user selecting one of two options multiplication or addition. Upon click of start, the system generates two random numbers in the range of 1-10 and poses a question appropiately, while storing the answer internally. User's response is checked against stored answer and a suitable message is given. A randomly picked suitable comment is appended to correct and wrong answer messages.", MsgBoxStyle.OkOnly, "How it Works!")
    End Sub

    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles multiplyradio.CheckedChanged
        feedbacktext.Clear()
        TextBox2.Clear()
    End Sub

    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles additionradio.CheckedChanged

    End Sub

    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles tutorbox.TextChanged
        Dim num1 As New Random
        Dim num2 As Integer

        If multiplyradio.Checked = True Then
            feedbacktext.Text = "How much is" & Val(num1) & "times" & Val(num2)

        Else
            additionradio.Checked = True
            feedbacktext.Text = Val(num1) + Val(num2)

        End If
    End Sub

End Class


This post has been edited by ebolisa: 15 October 2013 - 11:51 PM

Was This Post Helpful? 0
  • +
  • -

#3 ybadragon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 168
  • View blog
  • Posts: 1,033
  • Joined: 11-May 12

Re: I am done with writing the code. Error at beginning at Public class...

Posted 16 October 2013 - 05:15 AM

In your code, you don't have End class at the bottom. Post your code, and the EXACT errors you are getting.

and use [code][/code] tags.

This post has been edited by ybadragon: 16 October 2013 - 05:16 AM

Was This Post Helpful? 0
  • +
  • -

#4 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 426
  • View blog
  • Posts: 2,967
  • Joined: 12-January 10

Re: I am done with writing the code. Error at beginning at Public class...

Posted 16 October 2013 - 08:07 AM

post errors and your exact code...

 If multiplyradio.Checked = True Then 

194             tutorbox.Text = ("How much is " & a & "  times  " & B)/>/>/>/>  

195         End If 

196    

197         If additionradio.Checked = True Then 

198             tutorbox.Text = ("How much is " & a & "  plus  " & B)/>/>/>/>  

199         End If 




what are the
/>
for?

This post has been edited by DarenR: 16 October 2013 - 08:11 AM

Was This Post Helpful? 0
  • +
  • -

#5 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 348
  • View blog
  • Posts: 1,485
  • Joined: 08-April 09

Re: I am done with writing the code. Error at beginning at Public class...

Posted 16 October 2013 - 08:15 AM

I think that may be the forum bug, i've seen that before.
Was This Post Helpful? 0
  • +
  • -

#6 Jemmeh  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 20-March 10

Re: I am done with writing the code. Error at beginning at Public class...

Posted 18 October 2013 - 06:06 AM

Just glancing through this quickly--but it looks like you have the same Class twice in a row. Maybe just a copy and paste error. Do you have it twice in your program?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1