Results 1 to 3 of 3

Thread: vb6 list box

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    6

    vb6 list box

    I need to select multiple items in a list box at run-time from code so that my form wakes up with several items in a list box already selected.. The problem is that the list text property only works if multi-select is set to "none" and then of course only selects one item in the list box.

    Thanks!

  2. #2
    DerFarm
    Guest
    If I'm understanding you correctly, the following function will
    return a delimited string containg the selected list items. The
    delimiter = "^"

    Code:
    Function SelectedList(List1 as listbox) as string
       Dim I as integer
       Dim Ret_Val as string
    
       Ret_Val = ""  
       For I = 0 To List1.ListCount - 1
          If List1.Selected(I) Then
             Ret_val = Ret_val & "^" & List1.List(I)
          End If
       Next I
    
    Xit_SelectedList:
          SelectedList=Ret_Val
    End Function
    HTH

  3. #3
    Member Penavin's Avatar
    Join Date
    Oct 2001
    Location
    Sisak, Croatia
    Posts
    42

    Selecting contiguous items

    Do you want to see open list box with some (but not all) of available items selected? Must selection be contiguous?
    Penavin

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