Results 1 to 3 of 3

Thread: listbox array

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    146

    listbox array

    Hi there,

    can somebody show me how to retrieve all the items from the listbox for my gethistory sub.

    VB Code:
    1. Sub GetHistory(Index As Integer, Msg As String)
    2. Dim a As Integer
    3.  
    4. End Sub


    ' using Time makes the listbox flicker for some reason, o well

    VB Code:
    1. Public Sub AddHistory(Msg As String)
    2. On Error Resume Next
    3. Dim a As Integer
    4.  
    5. List1.AddItem Time & Msg, 0
    6. If List1.ListCount = 11 Then
    7. List1.RemoveItem 10
    8. End If
    9.  
    10. End Sub
    Last edited by mrnew; Aug 10th, 2006 at 06:10 AM.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: listbox array

    I'm not sure I understand. Your GetHistory Sub has an argument called Index, shouldn't that be the index of the item you want to retrieve? Anyway, to show each item in a listbox you simply have to loop through it.
    VB Code:
    1. Dim i As Integer
    2. For i = 0 To List1.ListCount - 1
    3.     MsgBox List1.List(i)
    4. Next

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    146

    Re: listbox array

    was just example code for an online game index is used to identify which player, btw, thanks alot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width