473,473 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Don't understand this warning message

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.
--
Terry
Jul 10 '06 #1
2 1101
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

"Terry" <Te***@nospam.nospamwrote in message
news:5A**********************************@microsof t.com...
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.
--
Terry

Jul 10 '06 #2
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,
--
Terry
"Claes Bergefall" wrote:
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

"Terry" <Te***@nospam.nospamwrote in message
news:5A**********************************@microsof t.com...
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.
--
Terry


Jul 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Danny | last post by:
Hi I don't understand why I keep getting "Error: Object expected" I tried different things and haven't been able to solve it. I'm a newbie so I'm not sure what I'm doing wrong. The debugger breaks...
5
by: rashmi | last post by:
Hello All, tp.c:107: error: syntax error before '*' token tp.c:108: warning: function declaration isn't a prototype tp.c:121: error: syntax error before '*' token tp.c:122: warning: function...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
24
by: Mike Otten | last post by:
Any help greatly appreciated. The validated page is at: http://myweb.stedwards.edu/michaelo/ddtab.htm The trouble is with the radio buttons (2/3-down the left column). The radios are...
2
by: tony | last post by:
Hello!! I use VS 2003 and C# for all class library except MeltPracCommon.dll which is C++.NET The problem is that I get these warnings when building the exe file and use my class libraries....
8
by: Charles Sullivan | last post by:
I have a program written in C under Linux (gcc) which a user has ported to run under AT&T SysV R4. He sent me a copy of his makelog which displays a large number of compiler warnings similar to...
1
by: Ian | last post by:
I've just discovered the msclr::lock class in the C++ Support Library online documentation. This seems like a much cleaner way to implement thread protection than using...
3
by: Hazza | last post by:
Hi, I am using PHP and mysql to create a website. I am fairly new to PHP, and thus am grateful to anyone who helps! Firstly I am running a homepage, that displays additional content if a user...
16
by: OldBirdman | last post by:
This code is in a Module called from an _Click event for my form named fAAA. Variables beginning ix... are Global Long, declared elsewhere. Public Sub QuickShow() On Error GoTo QuickShow_Error...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.