Results 1 to 8 of 8

Thread: [RESOLVED] Change listview.selecteditem thru code?

  1. #1

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Resolved [RESOLVED] Change listview.selecteditem thru code?

    I have a popupmenu on my listview, and that only fires when a person right clicks. I want it so that if the user right clicks it will still highlight the line they clicked on...possible?

  2. #2
    New Member
    Join Date
    Aug 2005
    Posts
    11

    Re: Change listview.selecteditem thru code?

    this is 100% out of this thread, but do you know what </vac> is? or msx?

    ...name looks farmiliar.

  3. #3

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Change listview.selecteditem thru code?

    no clue what <vac> is...does anyone have a reasonable answer?

  4. #4
    Fanatic Member
    Join Date
    Jan 2005
    Location
    In front of this pc.
    Posts
    580

    Re: Change listview.selecteditem thru code?

    In the click event you should be able to add lstViewName.ListItems(Index).Selected = True

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

    Re: Change listview.selecteditem thru code?

    Only it isn't a click event.... use the Mouse up event and check for the right-click.

    Part of the parameters to the event is the X & Y co-ord of the event. PAss those to the .HitTest method, which will pass back the item located under the cursor at the time of the mouseup. If it's nothing then the user didn't click over a usable listview item. If something does come back, use that object's (which should be a ListItem) .Selected property to select it.

    I think that's right.... it's been a while since I've done it... but that does sound right - I might have the data type wrong on the .HitTest return.

    Tg

    -ps viper-- was that *really* necessary?
    * 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??? *

  6. #6

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Change listview.selecteditem thru code?

    Thanks, that works perfect

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

    Re: Change listview.selecteditem thru code?

    What worked? His or mine? I'd like to know so that if I'm off base I don't do that again....

    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??? *

  8. #8

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: [RESOLVED] Change listview.selecteditem thru code?

    Both, i knew i had to put it in the mousedown event but with his code and such it worked

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