Results 1 to 2 of 2

Thread: [Beginner] Program to show Times Tables.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    17

    [Beginner] Program to show Times Tables.

    Hi,
    I'm currently trying to create a program that includes a text box (to input a number into), a button and a list box that will display the times tables for the number that is entered into the text box.

    The idea of the program is so that a user can enter a number into the text box, for example, the number 5 and all the times tables (up to 12) will be displayed;

    1x5 = 5
    2x5 = 10
    etc.

    I've started to code some of it but it doesn't seem to be working properly.
    Can anyone help me with the coding?

    Thanks in advance.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: [Beginner] Program to show Times Tables.

    try this:

    vb Code:
    1. Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    2.     ListBox1.Items.Clear()
    3.     Dim number As Integer = -1
    4.     If Integer.TryParse(TextBox1.Text, number) Then
    5.         If number > 0 Then
    6.             For x As Integer = 1 To 12
    7.                 ListBox1.Items.Add(x & "x" & number & "=" & number * x)
    8.             Next
    9.         End If
    10.     End If
    11. end sub
    Last edited by .paul.; Jan 3rd, 2010 at 09:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width