Results 1 to 8 of 8

Thread: Listview selected listitem

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Listview selected listitem

    have problem here, I have selected listitem in my listview and then I check the check the checkbox to true to update the record only this item, then the selected item in my listview is set clear.why? I want to the selected listitem retain the selected item in the listview when I check the checkbox to true.



    Code:
    Private Sub CheckBox1_Click()
    If CheckBox1.value = False Then
    Set ListView1.SelectedItem = Nothing
    End If
    End Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Listview selected listitem

    I don't understand your question.

    Are you using a Checked ListView (a listview with checkboxs) as your question would indicate, or a check box control that somehow interacts with the listview as your code would indicate?

  3. #3
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Listview selected listitem

    Is the HideSelection property set to True?

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Listview selected listitem

    Yes, It hide selection is set to true. But I don't know how to change the highlight color.
    Attached Images Attached Images  

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Listview selected listitem

    Highlight color??

    What does that have to do with check boxes and selected items and such as asked in the original question?

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Listview selected listitem

    Quote Originally Posted by matrik02
    have problem here, I have selected listitem in my listview and then I check the check the checkbox to true to update the record only this item, then the selected item in my listview is set clear.why? I want to the selected listitem retain the selected item in the listview when I check the checkbox to true.



    Code:
    Private Sub CheckBox1_Click()
    If CheckBox1.value = False Then
    Set ListView1.SelectedItem = Nothing
    End If
    End Sub
    If you want to keep it selected, why re you setting it to Nothing? Setting the SelectedItem to nothing clears the selection.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Listview selected listitem

    Quote Originally Posted by Hack
    Highlight color??

    What does that have to do with check boxes and selected items and such as asked in the original question?
    When I check the checkbox to false, then I want to clear the selected listitem. But then problem here, the check box is tick (true) then I point my cursor to the textbox to type the string, then the blue color clear. I don't why, I expected that when I move my cursor to the textbox and start typing in the textbox the blue color should not clear. I have to select it again..

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Listview selected listitem

    Quote Originally Posted by Ellis Dee
    Is the HideSelection property set to True?
    Quote Originally Posted by matrik02
    Yes, It hide selection is set to true. But I don't know how to change the highlight color.
    There... you answered it right there.... HideSelection is turned on. that means that when the control loses focus, it "hides" the selection.... it's not that it isn't selected, jsut that the highlight isn't showing. Set this property to FALSE to keep the highlight when it loses focus.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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