Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    32

    Unanswered: Clear list box of previous selections

    I have two multiselect list boxes which are very long which means that at times, it is difficult to find a previous selected item if two or more selections are made that are far apart. I would like to put a "Clear Selections" command button beside them that will clear the previous selections so that the user may select values from scratch again.

    I can't think of how this might be achieved, I would appreciate some help.

    TIA,
    Jules

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Clear list box of previous selections

    Originally posted by jrickards
    I have two multiselect list boxes which are very long which means that at times, it is difficult to find a previous selected item if two or more selections are made that are far apart. I would like to put a "Clear Selections" command button beside them that will clear the previous selections so that the user may select values from scratch again.

    I can't think of how this might be achieved, I would appreciate some help.

    TIA,
    To reset the listbox items (unselect them):

    Code:
        If AllocList.ItemsSelected.Count < 1 Then Exit Sub
        
        Dim i As Long, ItemCount As Integer, BDRow As Variant, SelArray() As Integer
        
        i = 1
        ItemCount = AllocList.ItemsSelected.Count
        ReDim SelArray(AllocList.ItemsSelected.Count)
        For Each BDRow In AllocList.ItemsSelected
            AllocList.Selected(BDRow) = False
            SelArray(i) = BDRow
            i = i + 1
        Next BDRow

  3. #3
    Join Date
    Feb 2004
    Posts
    32
    You are the Grand Poobah!

    Excellent, many thanks.
    Jules

Posting Permissions

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