2
Contributors
2
Replies
7
Views
11 Years
Discussion Span
Last Post by shalini_roy
1

how do i add the numbers in a listbox and display it in another textbox?

Create new project, add list1 and txtText1 to the form1 and paste:

Option Explicit

Private Sub Form_Load()
    Dim x As Integer
    Dim inx As Integer 'counter
    
    List1.AddItem "1"
    List1.AddItem "2"
    
    For inx = 0 To List1.ListCount - 1
        x = x + CInt(List1.List(inx))
    Next
    txtText1.Text = x
    
End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.