Results 1 to 12 of 12

Thread: [RESOLVED] Listview with checkboxes and multiselect

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Resolved [RESOLVED] Listview with checkboxes and multiselect

    I have a listview that I want to allow multiselect on. This listview also has checkboxes, and when you select an item, and then select another as well (multiselect) it checks the previous item (or items).

    I don't want this functionality, but I don't see a way to turn it off.

    I only want the checkboxes to be checked/unchecked by user clicking.. not by multiselecting.

    Has anyone tackled this before? I am currently trying to devise a way by trapping the shift and ctrl keys when selecting to deselect any items that become checked, but this seems rather cumbersome

  2. #2
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Listview with checkboxes and multiselect

    Mine doesn't do that.

    Even with OneClick on. What other options do you have selected? Which view?

    etc


    zaza

  3. #3
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: Listview with checkboxes and multiselect

    what version are you running?

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  4. #4
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: Listview with checkboxes and multiselect

    ok i'm not sure how you're doing it??? but let me see if i can get a handle for what you're doing... are you saying that if you hold the shift key down and have multiple items selected then you click one of the multiple items it selected all selected items??? because that's the only way i've had the problem

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  5. #5

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Listview with checkboxes and multiselect

    No, what was happening was this:

    I have a listview with 20 items and listview is set to have checkboxes and allow multiselect.

    If I click on the first listitem, and then hold shift and select the fifth listitem, it selects 1-5 as it should, but checks items 1-4 (or unchecks if they were already checked)

    I am using 1.1 (2003)

    I was able to use a work around

    VB Code:
    1. Private Sub lvwCustomers_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles lvwCustomers.ItemCheck
    2.         If _ShiftOrCtrlPressed Then
    3.             e.NewValue = e.CurrentValue
    4.         End If
    5.     End Sub
    6.  
    7.     Private Sub lvwCustomers_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lvwCustomers.KeyDown
    8.         If e.Shift Or e.Control Then
    9.             _ShiftOrCtrlPressed = True
    10.         End If
    11.     End Sub
    12.  
    13.     Private Sub lvwCustomers_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lvwCustomers.KeyUp
    14.         _ShiftOrCtrlPressed = False
    15.     End Sub

  6. #6
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: [RESOLVED] Listview with checkboxes and multiselect

    i realize you have a work around i'm just trying like hell to duplicate this on my machine and i can't get it to do it

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  7. #7

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] Listview with checkboxes and multiselect

    lol... hmmm well I am not crazy.. it was happening

    I will comment out my work around code and confirm my steps to produce it.

  8. #8
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: [RESOLVED] Listview with checkboxes and multiselect

    oh i believe you i just want to make sure that i'm doing the same thing you are to see if i can reproduce the same issue. is the first item checked???

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  9. #9

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] Listview with checkboxes and multiselect

    mystery solved. It behaves how I described only if .FullRowSelect is set to true (which it is in my case). It is set to false by default, and does not cause the checkboxes to be checked.

    In any event, I need to use my workaround, because I need fullrowselect.

  10. #10
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: [RESOLVED] Listview with checkboxes and multiselect

    ok that is by far the strangest thing i've seen. i finally got it to do it but it only happens when i have subitems and if i actually click on a subitem.

    if i select whatever item i select and hold the shift key down and select some other item that's the first item i doesn't place the checks...

    however if i select any item then hold the shift key down and click on an item that's a subitem then it does exactly what you were saying... just strange

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  11. #11

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] Listview with checkboxes and multiselect

    i am sure this is "by design" behavior, but I would think they would at least put an option to enable or disable it from happening.. oh well, at least im not scratching my head over it anymore

  12. #12
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Re: [RESOLVED] Listview with checkboxes and multiselect

    Quote Originally Posted by kleinma View Post
    i am sure this is "by design" behavior, but I would think they would at least put an option to enable or disable it from happening.. oh well, at least im not scratching my head over it anymore
    dear sir, did you find a better alternative?

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