design a vb form, when the user hits the add button the number in the text box will be added to the list box. when the user hit the sum button the number(s) in the list box will be added and the esult will be displayed in msgbox!!!
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
End Sub
Dim sum As Double
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
For i As Integer = 0 To ListBox1.Items.Count - 1
sum += Double.Parse(ListBox1.Items(i))
Next
MsgBox("Sum is " + sum.ToString())
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!