9
Январь
2009
Как посчитать сумму чисел в ComboBox?
Как посчитать сумму чисел в ComboBox?
То же самое можно применить и для ListBox.
Option Explicit Private Sub Command1_Click() Dim intCount As Integer Dim intSumm As Integer While Combo1.List(intCount) <> "" intSumm = intSumm + Val(Combo1.List(intCount)) intCount = intCount + 1 Wend Label1.Caption = "Сумма чисел в ComboBox: " & intSumm End Sub Private Sub Form_Load() Dim i As Integer For i = 1 To 10 Combo1.AddItem Format$(i) Next End Sub