Just wondering if anyone can help me with this slight issue. I'm writing a simple multiplications table using a list box to display the times tables when a user clicks a button. However, the numerous loops look quite messy and I would like to place them in a method/function that will allow the manipulation of integer values in the button click events so that the correct values can be inserted i.e 2x times would have a valueOne = 2 To valueTwo = 24 and Step = 2 (referencing the 2 times table) etc This is what I currently have just now (based on 7 times table example) but I feel I have not written my sub correctly. Any pointers and advice would be much appreciated and helpful. Thanks.
Note: Variables are declared globally
Private Sub newLoop()
For xTablesAnswer As Integer = valueOne To valueTwo Step valueThree
xTableNumOrder = xTableNumOrder + 1
lstData.Items.Add("7 Times " & xTableNumOrder.ToString & " = " & xTablesAnswer.ToString)
Next
End Sub
Private Sub bnt7X_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt7X.Click
ClearList()
valueOne = 7
valueTwo = 84
valueThree = 7
newLoop()
End Sub
End Class