[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.
Re: [Beginner] Program to show Times Tables.
try this:
vb Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
ListBox1.Items.Clear()
Dim number As Integer = -1
If Integer.TryParse(TextBox1.Text, number) Then
If number > 0 Then
For x As Integer = 1 To 12
ListBox1.Items.Add(x & "x" & number & "=" & number * x)
Next
End If
End If
end sub