Strange BC42025 warning

Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
        If e.Button = MouseButtons.Left Then
            ...

This code gives the following warning in VB 8.0:
warning BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

After changing to:
If e.Button = Left Then

there is no warning. I find this warning extremly stupid: does Microsoft want to encourage using enumeration members without qualified names? Except of this, MouseButtons is not instance.
Is there way to correct this without removing qualified name, and what does really VB compiler want?
LVL 48
AlexFMAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gbzhhuCommented:
       If e.Button = Windows.Forms.MouseButtons.Left Then

works
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gbzhhuCommented:
The Left that you think is working for you is the forms left property
0
gbzhhuCommented:
I believe the trouble is that MouseButtons is a shared property and cannot be called without qualifying with class or struct.  this property is in class Forms

You can import

Imports System.Windows

then Forms.MouseButtons.Left   will work

0
AlexFMAuthor Commented:
Windows.Forms.MouseButtons.Left fixes this problem. Your second post is also right.
But I still think that this is VB compiler bug, because MouseButtons is not property in this context, this is enumeration. Your third post explains the reason of this bug, compiler is confused because there is also such property. Great work, thanks.
0
gbzhhuCommented:
No probs Alex.  I am glad to be of help to those I consider superior to me in their .NET adventure ;-)

I didn't realise the bug until your post which makes sense.  Thanks for the grade A  I am chuffed
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.