CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002

    Question about the Cursor


    I would like to know something. I have no problem to change the cursor but when i code this :

    Cursor.Current = Cursors.WaitCursor

    I always have a warning with the Cursor.Current part saying :

    Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

    But if i code it this way there's no problem :

    System.Windows.Forms.Cursor.Current = Cursors.WaitCursor

    Is someone know why ?

    Thanks a lot

  2. #2
    Join Date
    Jan 2006

    Re: Question about the Cursor

    You have an object name that you called "Cursor", as in "Dim Cursor as New Cursor", and you are trying to use that shared .Current Property of the Cursor class. It is either that, or more simply, you just typed it out as "Cursor.Current", which is actually like saying "Me.Cursor.Current", which would still be accessing that through an instance, the instance of the form. Shared properties do not require an instance of a class to set, and really shouldn't be, as that warning is letting you know. You don't receive the error when you use the fully qualified name because, as it is shared, you do not need an instance of an object in order to set, therefore needing the full "Windows.Forms.Cursor" name in order to access. Shared properties or methods should not be used from an instance of a class.
    Last edited by gigemboy; December 8th, 2006 at 12:50 PM.

  3. #3
    Join Date
    Oct 2005
    Islamabad, Pakistan

    Re: Question about the Cursor

    As Cursor is a shared property so use of an instance i-e Me is useless.
    Here studio informs u that Me will not be evaluated thus makes u to use the class instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.