|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Don't understand this warning messageI 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 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 Show quoteHide quote "Terry" <Terry@nospam.nospam> wrote in message news:5A7DBED8-B7F8-492D-AC01-EF715E2D5233@microsoft.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 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, -- Show quoteHide quoteTerry "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" <Terry@nospam.nospam> wrote in message > news:5A7DBED8-B7F8-492D-AC01-EF715E2D5233@microsoft.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 > > >
combobox gives unexpected cast error
Redrawing graphics in userControl - Button How to use ADO command object to get a record set via stored procedure? start new thread help Get Icon from CallingAssembly (or ...) ListView iteration order web browser control auto scroll window application refresh every minute Re: Listview selected item ToolTip |
|||||||||||||||||||||||