Results 1 to 5 of 5

Thread: checkboxes on list

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    425

    Question checkboxes on list

    how do i check all the boxes avaliable on a listview or uncheck all at 1 time? is there a simple function for it or i have to use a for loop a check all 1 by 1?

  2. #2
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    I think you have to use a loop and check all of them manually.
    <removed by admin>

  3. #3
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Check/uncheck all items in a listview:
    VB Code:
    1. For i = 1 To ListView1.ListItems.Count
    2.     ListView1.ListItems(i).Checked = Not ListView1.ListItems(i).Checked
    3. Next
    <removed by admin>

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    425
    can you explain the codes please......
    i dont understand the logic

    thanks alot it works

  5. #5
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    With Comments:
    VB Code:
    1. For i = 1 To ListView1.ListItems.Count 'start the loop through all the items in the listview
    2.     ListView1.ListItems(i).Checked = Not ListView1.ListItems (i).Checked 'if the checkbox on listitem(i)
    3.                                                                          'is checked, it will uncheck it,
    4.                                                                          'if it is unchecked, it will check it
    5.                                                                          'Using Not is like saying set the value
    6.                                                                          'to the opposite of the current state
    7. Next 'start the loop over...
    <removed by admin>

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