Results 1 to 5 of 5

Thread: make item have selected effect in listview when listview loses focus *RESOLVED*

  1. #1

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

    Question make item have selected effect in listview when listview loses focus *RESOLVED*

    does anyone know how to make an item in a listview appear selected after the listview loses focus. everytime i select an item in a listview and the listview loses focus, the item no longer appears selected even though it is, ie the highlighting disappears. can anyone tell me how to make it stay visiable.


    thanx in advance
    Last edited by vbdotnetboy; Jul 8th, 2004 at 09:25 AM.

    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

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi

    Put the following in the ListBox_SelectedIndexChanged event.

    VB Code:
    1. Dim item As ListViewItem
    2.             For Each item In LstDet.Items
    3.                 item.ForeColor = LstDet.ForeColor
    4.                 item.Font = New Font(LstDet.Font, FontStyle.Regular)
    5.             Next
    6.             LstDet.Items(LstDet.SelectedIndices(0)).Font = New Font(Font, FontStyle.Bold)

    This will reset all List View entries to normal font and then highlight the last one selected. When the ListBox loses focus the highlight will remain.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  3. #3
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    I think this is the easiest way.
    VB Code:
    1. ListView1.HideSelection=False
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by pax
    I think this is the easiest way.
    VB Code:
    1. ListView1.HideSelection=False
    You're right.

    I'm sure I tried that recently and found that it was not satisfactory, but I can't remember why

    Maybe I did not like the greying effect.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5

    Thread Starter
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310
    thanx taxes and pax for the response. both methods helped solve my issue.


    thanx again.

    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

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