Ranking
Original Post
Help with VB assignment
Guys. for the last hour I worked on this fucker
Public Class Form1
    Dim inttextinput As Integer
    Dim intamounttime As Integer
    Dim intanswer As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtinput.Text = "Please enter a number between 1 and 12"
    End Sub
    Private Sub txtinput_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtinput.Click

        'this notifies the user what number they should enter
        If txtinput.Text = "Please enter a number between 1 and 12" Then
            txtinput.Text = ""
        End If
    End Sub

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5Timestables.Click

        inttextinput = txtinput.Text + 1
        intamounttime = 0

        For timetable As Integer = 1 To 13
            If inttextinput > 13 Then
                MsgBox("Sorry you can only enter numbers up to 12")
                End
            ElseIf inttextinput < 1 Then
                MsgBox("Sorry you cant enter numbers less than 1")
                End
            End If

            intanswer = intamounttime * txtinput.Text
            MsgBox(intamounttime & "x" & txtinput.Text & "=" & intanswer)
            intamounttime = intamounttime + 1
            If timetable = inttextinput Then

            End If
        Next
        txtinput.Text = "Please enter a number between 1 and 12"
    End Sub


End Class
You're probably wondering what that code does. you probably think it does something awesome. Nope.
Originally Posted by My dickhead bad wording task teacher
Create a times-table program for children to learn their 12 times table.
Children should be able to enter a number between 1 and 12, and then click a button.
When the button is clicked, the program should use a loop to output the ‘times table’ for that particular number.

For example, if the number ‘5’ is entered, the program should display:
1 x 5 = 5
2 x 5 = 10
3 x 5 = 15
… all the way up to…
12 x 5 = 60

The output can be in either a label(s), or messagebox(s).
The program should also have an exit button.
If the children enter a number not between 1 and 12, or something that is not a number, the program should display an error message.

. He asked me to do 12 times tables but in the examples 5 is the only reoccurring number so I guess he meant 5 times tables. if not I can change it to 12 by modifying two lines. anyway, If any of you guys know some sort of VB can you confirm to me that this is indeed correct? It's hard to self break a program

ok so I derped a little bit on reading the task. fixed the code
Last edited by RedPanda; Oct 24, 2014 at 01:30 AM.
Life's not a waste of time and time's not a waste of life so let's stop wasting time, get wasted and have the time of our lives - Mr Worldwide 3:18