Results 1 to 9 of 9

Thread: Mouse pointer in listview

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Cape Town, SA
    Posts
    144

    Mouse pointer in listview

    Hi

    I want to change the mouse pointer when it moves onto a listview to a hand. I tried to put the following line of code in the mouse hover event of the listview:

    Me.Cursor = Cursors.hand

    the problem is that cursors.hand doesnt exist in that sub.

    Does anyone know how I can get arouind this?

    Thanking you in advance

    PORRASTAR

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    No code needed at all.

    the listview should have a cursor property that you can set directly from the designer.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    I didn't understand.....which is the problem in a routine like this one?:

    VB Code:
    1. Private Sub ListView1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.MouseHover
    2.         Me.Cursor = Cursors.Hand
    3.     End Sub
    Live long and prosper (Mr. Spock)

  4. #4
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    I'm not sure... but doesn't Me mean whatever object is currently processing that code?

    So at that instant the object processing that code is the listview, so wouldn't Me mean the Listview?

    I don't know about this really... but that's what I thought. I never, EVER, use Me though myself. I stay away from it because I am never sure what Me actually is. Just reference the actual form so much better when reading your code!

    In my opinion anyway... but i'm probably speaking garbage about the Me thing being the object processing the code at the moment, i dunno really.

    edit: although thinking about that now... if you used Me.Cursor, the code would have gone mad because cursor doesn't belong to the listview control, only the form if i'm right... i'm not sure lol!!!

    I should stop confusing myself!

  5. #5
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    Dear Lithia, when you write 'Me' and add a point you unchain the intellisense that shows a lot of informations. If among them you can find your listview, surely Me is meaning the actual Form. If Me were intended as your listview, you'd see only its properties and methods.....I think!
    Live long and prosper (Mr. Spock)

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    yes ME refers to the class only

    so in your own class you can use ME and since in .net forms are classes, using ME signifies accessing the form

    and alextyx i didnt see anything wrong with ur code
    VB Code:
    1. Private Sub ListView1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.MouseHover
    2.         Me.Cursor = Cursors.Hand
    3.     End Sub

  7. #7
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    thanks for reasuring me! I knew Me either meant what i thought it meant, or the class

  8. #8
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    Yes Kleinma, but I wrote that code because PORRASTAR said he has found some problem (that I didn't)while writing it. As you, I don't understand which is the problem. I think the code is right. So I have to wait for PORRASTAR's reply to understand better his question!
    Live long and prosper (Mr. Spock)

  9. #9
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by alextyx
    Yes Kleinma, but I wrote that code because PORRASTAR said he has found some problem (that I didn't)while writing it. As you, I don't understand which is the problem. I think the code is right. So I have to wait for PORRASTAR's reply to understand better his question!

    gotcha... to be honest, i though you originally started the thread.. thats why i was a little confused


    maybe he doesnt have System.Windows.Forms in his projects imports list so thats why he says Cursors.Hand doesnt exist...

    cause he needs to either have that imported, or use the fully qualified

    System.Windows.Forms.Cursors.Hand

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