Public Class Form1
Private Sub txtUpperlimit_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtUpperlimit.TextChanged
resultListBox.Items.Clear()
End Sub
''' <summary>
''' Calculate button
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalculate.Click
Try
Dim counter As Integer = 1
resultListBox.Items.Clear()
resultListBox.Items.Add("N" + vbTab + "N^2" + vbTab +
"N^3")
Do Until counter > Integer.Parse(txtUpperlimit.Text)
resultListBox.Items.Add(counter.ToString() + vbTab + Math.Pow(counter,
2).ToString() + vbTab + Math.Pow(counter, 3).ToString())
counter += 1
Loop
Catch ex As Exception
MessageBox.Show("Incorrect data")
End Try
End Sub
End Class
Comments
Leave a comment