Answer to Question #20862 in Visual Basic for mohammad

Question #20862
design a vb form, the user will enter a number & then click the button, the result should display in list box the multiplication table of your number (by the numbers 1 to 10)...
what is the code for this question??
1
Expert's answer
2012-12-20T07:39:47-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS