Don't understand this warning message

G

Guest

Hi,
I copied the following code segment from the VS2005 Help on the MouseDown
event.
Private Sub panel1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles panel1.MouseDown
.....
Select Case e.Button
Case MouseButtons.Left <-Warning
eventString = "L"
Case MouseButtons.Right <-Warning
eventString = "R"
Case MouseButtons.Middle <-Warning
eventString = "M"
.....etc.
the warning message is: Warning Access of shared member, constant member,
enum member or nested type through an instance; qualifying expression will
not be evaluated.
I just don't see how MouseButtons.Right (etc) is refering to an instance.
The recomended fix is to replace MouseButtons with Windows.Forms.MouseButtons.
 
C

Claes Bergefall

MouseButtons is also a property in the Control class and since your code is
(I assume) inside a Form or similar it thinks you're refering to that
property instead of the enum. Hence the warning.

/claes
 
G

Guest

Hi Claes,
Thanks - I was just getting there myself. 'MouseButtons' is a property
of System.Windows.Forms.Form, which of course, this form inherits.
Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top