Results 1 to 3 of 3

Thread: Select All In ListBox

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Location
    Fantasia, Castle Donnington 1993
    Posts
    8

    Question Select All In ListBox

    Does anyone know of a way to select all the items in a List Box ? I know you can do this in VB but the listbox in Access (XP) does not seem to support this.

    Cheers

    Paul

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    The only way I've managed to do this is by using the following:
    VB Code:
    1. [color="#0000A0"]Private[/color] [color="#0000A0"]Sub[/color] Command2_Click()
    2.     [color="#0000A0"]Dim[/color] intCounter [color="#0000A0"]As[/color] [color="#0000A0"]Integer[/color]
    3.    
    4.     [color="#0000A0"]For[/color] intCounter = 1 [color="#0000A0"]To[/color] List0.ListCount
    5.         List0.Selected(intCounter) = [color="#0000A0"]True[/color]
    6.     [color="#0000A0"]Next[/color]
    7. [color="#0000A0"]End[/color] [color="#0000A0"]Sub[/color]
    You're meant to be able to set the multiselect property through code, but this doesn't work so you'll need to select this roperty of the listbox at design time to the last option (2).

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Location
    Fantasia, Castle Donnington 1993
    Posts
    8
    Cheers Alex it works like a charm. Its so obvious as well......someties you can't see the wood for the trees !!!!

    Paul

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