Answer to Question #21443 in Visual Basic for zoubi

Question #21443
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!!!
1
Expert's answer
2013-01-29T11:47:16-0500
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS