|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Whats's the problem using a enum like this?If e.Button = MouseButtons.Left Then
also from a Dim Answer As DialogResult = MessageBox.Show.. Select Case Answer Case DialogResult.Yes and many other uses of an enum I get Warning 153 Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. Why not. What's the problem using a enum like this? Are you sure this is one of those cases? The code you have there wouldn't
generate those types of warnings - it doesn't for me. Show quoteHide quote " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message news:OrvAdO3IGHA.2064@TK2MSFTNGP09.phx.gbl... > If e.Button = MouseButtons.Left Then > > also from a > > Dim Answer As DialogResult = MessageBox.Show.. > > Select Case Answer > > Case DialogResult.Yes > > and many other uses of an enum I get > > Warning 153 Access of shared member, constant member, enum member or > nested type through an instance; qualifying expression will not be > evaluated. > > > > Why not. What's the problem using a enum like this? > > > > > >
Show quote
Hide quote
" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: The problem is that forms have a 'DialogResult' property which shadows the > If e.Button = MouseButtons.Left Then > > also from a > > Dim Answer As DialogResult = MessageBox.Show.. > > Select Case Answer > > Case DialogResult.Yes > > and many other uses of an enum I get > > Warning 153 Access of shared member, constant member, enum member or > nested type through an instance; qualifying expression will not be > evaluated. type 'DialogResult'. Either fully qualify the 'DialogResult' type ('System.Windows.Forms.DialogResult') or define a namespace alias: \\\ Imports WinForms = System.Windows.Forms .... If Answer = WinForms.DialogResult.OK Then ... End If /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Not as simple as I thought.
Many places where I set Cursor.Current I get the same message. Consider the following sub I get the error at each Cursor.Current Got any more wisdom to share? Public Shared Sub SetToWaitCursor(ByVal c As Control) 'This sub set Cursor.Current to Cursors.WaitCursor for all controls in c.Controls - searches 3 levels On Error Resume Next For Each C1 As Control In c.Controls For Each C2 As Control In C1.Controls For Each C3 As Control In C1.Controls C3.Cursor.Current = Cursors.WaitCursor Next C3 C1.Cursor.Current = Cursors.WaitCursor Next C2 C1.Cursor.Current = Cursors.WaitCursor Next C1 End Sub Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:O8wYUj3IGHA.1728@TK2MSFTNGP09.phx.gbl... >" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: >> If e.Button = MouseButtons.Left Then >> >> also from a >> >> Dim Answer As DialogResult = MessageBox.Show.. >> >> Select Case Answer >> >> Case DialogResult.Yes >> >> and many other uses of an enum I get >> >> Warning 153 Access of shared member, constant member, enum member or >> nested type through an instance; qualifying expression will not be >> evaluated. > > The problem is that forms have a 'DialogResult' property which shadows the > type 'DialogResult'. Either fully qualify the 'DialogResult' type > ('System.Windows.Forms.DialogResult') or define a namespace alias: > > \\\ > Imports WinForms = System.Windows.Forms > ... > If Answer = WinForms.DialogResult.OK Then > ... > End If > /// > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> " **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: The line above should read '... In C2.Controls', shouldn't it?> For Each C1 As Control In c.Controls > > For Each C2 As Control In C1.Controls > > For Each C3 As Control In C1.Controls > C3.Cursor.Current = Cursors.WaitCursor => 'C3.Cursor = Cursors.WaitCursor'.-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message Boy! Sharp eyes.news:OAvBJs6IGHA.2040@TK2MSFTNGP14.phx.gbl... >" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: >> For Each C1 As Control In c.Controls >> >> For Each C2 As Control In C1.Controls >> >> For Each C3 As Control In C1.Controls > > The line above should read '... In C2.Controls', shouldn't it? > This a change in 2005 or was it wrong in 2003 also??>> C3.Cursor.Current = Cursors.WaitCursor > > => 'C3.Cursor = Cursors.WaitCursor'. Thanks a lot Show quoteHide quote > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/>
Show quote
Hide quote
" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: It should have been written as 'C3.Cursor = Cursors.WaitCursor' in VB.NET >>> For Each C1 As Control In c.Controls >>> >>> For Each C2 As Control In C1.Controls >>> >>> For Each C3 As Control In C1.Controls >> >> The line above should read '... In C2.Controls', shouldn't it? > Boy! Sharp eyes. > >> >>> C3.Cursor.Current = Cursors.WaitCursor >> >> => 'C3.Cursor = Cursors.WaitCursor'. > > This a change in 2005 or was it wrong in 2003 also?? 2003 too. 'Cursor.Current' is something different. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> I thought Cursor.Current was used so that when you exited the method the
cursor revered to what it was when you entered or to the default - can't remember which I thought. Don't know where I learned this (or mislearned) Also, the cursor change is application wide - just verified this but not the above. Anyway, maybe it's not what I need but what is wrong with C3.Cursor.Current = Cursors.WaitCursor after all there is a Cursor.Current property? Why Warning 153 Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. for C3.Cursor.Current = Cursors.WaitCursor THANKS Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:enXCtNAJGHA.2320@TK2MSFTNGP11.phx.gbl... >" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: >>>> For Each C1 As Control In c.Controls >>>> >>>> For Each C2 As Control In C1.Controls >>>> >>>> For Each C3 As Control In C1.Controls >>> >>> The line above should read '... In C2.Controls', shouldn't it? >> Boy! Sharp eyes. >> >>> >>>> C3.Cursor.Current = Cursors.WaitCursor >>> >>> => 'C3.Cursor = Cursors.WaitCursor'. >> >> This a change in 2005 or was it wrong in 2003 also?? > > It should have been written as 'C3.Cursor = Cursors.WaitCursor' in VB.NET > 2003 too. 'Cursor.Current' is something different. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> Scratch this! I just read Jay's post
Thanks Show quoteHide quote " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message news:ehUbHsBJGHA.3192@TK2MSFTNGP10.phx.gbl... >I thought Cursor.Current was used so that when you exited the method the >cursor revered to what it was when you entered or to the default - can't >remember which I thought. Don't know where I learned this (or mislearned) > > Also, the cursor change is application wide - just verified this but not > the above. > > Anyway, maybe it's not what I need but what is wrong with > C3.Cursor.Current = Cursors.WaitCursor > after all there is a Cursor.Current property? > > Why > Warning 153 Access of shared member, constant member, enum member or > nested > type through an instance; qualifying expression will not be evaluated. > > for > C3.Cursor.Current = Cursors.WaitCursor > > > > THANKS > > > > > > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message > news:enXCtNAJGHA.2320@TK2MSFTNGP11.phx.gbl... >>" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: >>>>> For Each C1 As Control In c.Controls >>>>> >>>>> For Each C2 As Control In C1.Controls >>>>> >>>>> For Each C3 As Control In C1.Controls >>>> >>>> The line above should read '... In C2.Controls', shouldn't it? >>> Boy! Sharp eyes. >>> >>>> >>>>> C3.Cursor.Current = Cursors.WaitCursor >>>> >>>> => 'C3.Cursor = Cursors.WaitCursor'. >>> >>> This a change in 2005 or was it wrong in 2003 also?? >> >> It should have been written as 'C3.Cursor = Cursors.WaitCursor' in VB.NET >> 2003 too. 'Cursor.Current' is something different. >> >> -- >> M S Herfried K. Wagner >> M V P <URL:http://dotnet.mvps.org/> >> V B <URL:http://classicvb.org/petition/> > >
Show quote
Hide quote
" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb Current is a /shared/ method. You are referring to it by an object > I thought Cursor.Current was used so that when you exited the method > the cursor revered to what it was when you entered or to the default > - can't remember which I thought. Don't know where I learned this > (or mislearned) > > Also, the cursor change is application wide - just verified this but > not the above. > > Anyway, maybe it's not what I need but what is wrong with > C3.Cursor.Current = Cursors.WaitCursor > after all there is a Cursor.Current property? > > Why > Warning 153 Access of shared member, constant member, enum member or > nested type through an instance; qualifying expression will not be > evaluated. > > for > C3.Cursor.Current = Cursors.WaitCursor reference. This makes the code look like it is a property of C3. It is /not/ a property of C3 because it is a /shared/ member. Therefore, you should refer to it by the class name. You can even change the Current property if you do not have a single control, because the Current property is independent from any control. Both, - C3.Cursor.Current = Cursors.WaitCursor - System.Windows.Forms.Cursor.Current = Cursors.WaitCursor do /exactly/ the same. There's only the problem, when you read the code, that the first version indicates that the Current property belongs anyhow to control C3. This is not true. Despite, the compiler knows what you mean (you mean the 2nd version), and gives a warning only. Armin But does it make sense to do this (see code below) at all.
I call it with c referencing a usercontrol so as to set the cursor for all the controls on the usercontrol. I mean - is there a better way? Do I have to reset all the cursors to default when I'm done (it's not automatically done is it?) ===== Also ( I wrote this in another post) I believe I have an instance where a sub sets the cursor, call another sub which also sets the cursor and it then resets it before returning and before the first sub wants it reset. How do I get around that? Public Shared Sub SetToWaitCursor(ByVal c As Control) 'This sub sets Cursor to Cursors.WaitCursor for all controls in c.Controls - searches 3 levels On Error Resume Next For Each C1 As Control In c.Controls For Each C2 As Control In C1.Controls For Each C3 As Control In C2.Controls C3.Cursor = Cursors.WaitCursor Next C3 C1.Cursor = Cursors.WaitCursor Next C2 C1.Cursor = Cursors.WaitCursor Next C1 End Sub > because it is Shared - I think I've got it - thanks> - C3.Cursor.Current = Cursors.WaitCursor > - System.Windows.Forms.Cursor.Current = Cursors.WaitCursor > > do /exactly/ the same. And the first one produces the warning message because it's confusing way of doing it " **Developer**" <REMOVEdevelo***@a-znet.com> schrieb I didn't follow the whole thread, so maybe it's already been mentioned:> But does it make sense to do this (see code below) at all. > I call it with c referencing a usercontrol so as to set the cursor > for all the controls on the usercontrol. > I mean - is there a better way? You first have to determine what you want the cursor to indicate: If the user can not operate the UI, you can set the Current property of the Cursor class to the WaitCursor. I don't see why you would ever want to set the WaitCursor for each single control. If the user has to wait, he has to wait, no matter where the cursor is located. After an action has been done, set Cursor.Current back to Cursors.Default. > Do I have to reset all the cursors to default when I'm done (it's If the user can operate the UI, set the cursor just like you want. If you> not automatically done is it?) need to set the cursor of the contained controls also, the loops below (or a recursive sub) probably work. The cursor is not set back automatically. You have to do it also. But again, I think setting a WaitCursor for controls doesn't make sense, IMO. Show quoteHide quote > ===== Armin> > Also ( I wrote this in another post) I believe I have an instance > where a sub sets the cursor, call another sub which also sets the > cursor and it then resets it before returning and before the first > sub wants it reset. > > How do I get around that? > > > Public Shared Sub SetToWaitCursor(ByVal c As Control) > > 'This sub sets Cursor to Cursors.WaitCursor for all controls in > c.Controls - searches 3 levels > > On Error Resume Next > > For Each C1 As Control In c.Controls > > For Each C2 As Control In C1.Controls > > For Each C3 As Control In C2.Controls > > C3.Cursor = Cursors.WaitCursor > > Next C3 > > C1.Cursor = Cursors.WaitCursor > > Next C2 > > C1.Cursor = Cursors.WaitCursor > > Next C1 > > End Sub
Show quote
Hide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message I believe you're correct. What I need to do isnews:%234eUOtEJGHA.2828@TK2MSFTNGP12.phx.gbl... >" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb >> But does it make sense to do this (see code below) at all. >> I call it with c referencing a usercontrol so as to set the cursor >> for all the controls on the usercontrol. >> I mean - is there a better way? > > I didn't follow the whole thread, so maybe it's already been mentioned: > > You first have to determine what you want the cursor to indicate: > > If the user can not operate the UI, you can set the Current property of > the > Cursor class to the WaitCursor. I don't see why you would ever want to set > the WaitCursor for each single control. If the user has to wait, he has to > wait, no matter where the cursor is located. After an action has been > done, > set Cursor.Current back to Cursors.Default. > > >> Do I have to reset all the cursors to default when I'm done (it's >> not automatically done is it?) > > If the user can operate the UI, set the cursor just like you want. If you > need to set the cursor of the contained controls also, the loops below (or > a recursive sub) probably work. The cursor is not set back automatically. > You have to do it also. But again, I think setting a WaitCursor for > controls doesn't make sense, IMO. > set the Current property of the Cursor class to the WaitCursor just took awhile to realize it! Thanks **Developer**
In addition to Herfried's comments: Cursor is a property of Control, Cursor is also a type that has a shared property of Current | C3.Cursor.Current = Cursors.WaitCursor ^ should be C2 shouldn't it?| C1.Cursor.Current = Cursors.WaitCursor | C1.Cursor.Current = Cursors.WaitCursor In the above three lines you are setting the shared property System.Windows.Forms.Cursor.Current to Cursors.WaitCursor, you are NOT modifying any control's Cursor property! >> This a change in 2005 or was it wrong in 2003 also?? If you used this code "as is" in VB2003, then yes your code was wrong in VB2003 also! FWIW: This is a very good example of why the warning was added! To modify the Cursor property of a Control, you simply: Dim C1 As Control C1.Cursor = Cursors.WaitCursor You don't need the pseudo recursion. You can simplify your routine to: Public Shared Sub SetToWaitCursor(ByVal c As Control) ' qualify the name to avoid attempting to use the Form/Control property System.Windows.Forms.Cursor.Current = Cursors.WaitCursor End Sub Which is effectively what you were running in VB 2003. If you "need" the pseudo recursion, try: For Each C1 As Control In c.Controls For Each C2 As Control In C1.Controls For Each C3 As Control In C2.Controls C3.Cursor = Cursors.WaitCursor Next C3 C2.Cursor = Cursors.WaitCursor Next C2 C1.Cursor = Cursors.WaitCursor Next C1 -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message news:Op%238Ba6IGHA.2064@TK2MSFTNGP09.phx.gbl... | Not as simple as I thought. | | Many places where I set Cursor.Current I get the same message. | | Consider the following sub | | I get the error at each Cursor.Current | | Got any more wisdom to share? | | | | | | Public Shared Sub SetToWaitCursor(ByVal c As Control) | | 'This sub set Cursor.Current to Cursors.WaitCursor for all controls in | c.Controls - searches 3 levels | | On Error Resume Next | | For Each C1 As Control In c.Controls | | For Each C2 As Control In C1.Controls | | For Each C3 As Control In C1.Controls | | C3.Cursor.Current = Cursors.WaitCursor | | Next C3 | | C1.Cursor.Current = Cursors.WaitCursor | | Next C2 | | C1.Cursor.Current = Cursors.WaitCursor | | Next C1 | | End Sub | | "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message | news:O8wYUj3IGHA.1728@TK2MSFTNGP09.phx.gbl... | >" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: | >> If e.Button = MouseButtons.Left Then | >> | >> also from a | >> | >> Dim Answer As DialogResult = MessageBox.Show.. | >> | >> Select Case Answer | >> | >> Case DialogResult.Yes | >> | >> and many other uses of an enum I get | >> | >> Warning 153 Access of shared member, constant member, enum member or | >> nested type through an instance; qualifying expression will not be | >> evaluated. | > | > The problem is that forms have a 'DialogResult' property which shadows the | > type 'DialogResult'. Either fully qualify the 'DialogResult' type | > ('System.Windows.Forms.DialogResult') or define a namespace alias: | > | > \\\ | > Imports WinForms = System.Windows.Forms | > ... | > If Answer = WinForms.DialogResult.OK Then | > ... | > End If | > /// | > | > -- | > M S Herfried K. Wagner | > M V P <URL:http://dotnet.mvps.org/> | > V B <URL:http://classicvb.org/petition/> | |
Show quote
Hide quote
> Is there recursion in the above?> If you "need" the pseudo recursion, try: > > For Each C1 As Control In c.Controls > For Each C2 As Control In C1.Controls > For Each C3 As Control In C2.Controls > C3.Cursor = Cursors.WaitCursor > Next C3 > C2.Cursor = Cursors.WaitCursor > Next C2 > C1.Cursor = Cursors.WaitCursor > Next C1 > > > -- I believe it is called with c referencing a usercontrol that contains many controls on it, so as to set the cursor for all of them. Also, do I need to reset the cursor? I think I remember a case where a Sub set the cursor, called another Sub that also set the cursor and then reset it to default which negated the effect of the first Sub's set. Is this the way it works. How to get around it? Thanks for the help | Is there recursion in the above? Yes, but it may not be obvious...You could have written your routine as: Public Shared Sub SetToWaitCursor(ByVal c As Control) For Each C1 As Control In c.Controls SetToWaitCursor(C1) C1.Cursor = Cursors.WaitCursor Next C1 End Sub You simply physically nested the call to self & limited it to 3 levels. I suspect your form has many more then 3 levels of controls! | Also, do I need to reset the cursor? Which is why, rather then change a control's cursor I normally change Yes. System.Windows.Forms.Cursor, in VS.NET 2005, I use the following class: ' ' Copyright © 2005, Jay B. Harlow, All Rights Reserved. ' Option Strict On Option Explicit On Public Class WaitCursor Implements IDisposable Private ReadOnly m_previous As Cursor Private ReadOnly m_newCursor As Cursor Public Sub New() MyClass.New(Cursors.WaitCursor) End Sub Public Sub New(ByVal newCursor As Cursor) If newCursor Is Nothing Then Throw New ArgumentNullException("newCursor") m_previous = Cursor.Current m_newCursor = newCursor Cursor.Current = m_newCursor End Sub Public Sub Restore() Cursor.Current = m_newCursor End Sub Public Sub Dispose() Implements IDisposable.Dispose Cursor.Current = m_previous End Sub End Class To use it I simply: Using wc As New WaitCursor() ' do work here End Using Using will automatically call the WaitCursor.Dispose method that reverts the cursor to what it was. You can use the overload New if you want a cursor other then a WaitCursor... -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message news:efOKk4BJGHA.1188@TK2MSFTNGP14.phx.gbl... | > | > If you "need" the pseudo recursion, try: | > | > For Each C1 As Control In c.Controls | > For Each C2 As Control In C1.Controls | > For Each C3 As Control In C2.Controls | > C3.Cursor = Cursors.WaitCursor | > Next C3 | > C2.Cursor = Cursors.WaitCursor | > Next C2 | > C1.Cursor = Cursors.WaitCursor | > Next C1 | > | > | > -- | Is there recursion in the above? | I believe it is called with c referencing a usercontrol that contains many | controls on it, so as to set the cursor for all of them. | | Also, do I need to reset the cursor? | I think I remember a case where a Sub set the cursor, called another Sub | that also set the cursor and then reset it to default which negated the | effect of the first Sub's set. | Is this the way it works. | How to get around it? | | | Thanks for the help | | Thanks for spending so much time on this.
I'll have to study what you show below! Show quoteHide quote "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@tsbradley.net> wrote in message news:uff3rBGJGHA.1288@TK2MSFTNGP09.phx.gbl... >| Is there recursion in the above? > Yes, but it may not be obvious... > > You could have written your routine as: > > Public Shared Sub SetToWaitCursor(ByVal c As Control) > For Each C1 As Control In c.Controls > SetToWaitCursor(C1) > C1.Cursor = Cursors.WaitCursor > Next C1 > End Sub > > You simply physically nested the call to self & limited it to 3 levels. I > suspect your form has many more then 3 levels of controls! > > | Also, do I need to reset the cursor? > Yes. > > Which is why, rather then change a control's cursor I normally change > System.Windows.Forms.Cursor, in VS.NET 2005, I use the following class: > > ' > ' Copyright © 2005, Jay B. Harlow, All Rights Reserved. > ' > Option Strict On > Option Explicit On > > Public Class WaitCursor > Implements IDisposable > > Private ReadOnly m_previous As Cursor > Private ReadOnly m_newCursor As Cursor > > Public Sub New() > MyClass.New(Cursors.WaitCursor) > End Sub > > Public Sub New(ByVal newCursor As Cursor) > If newCursor Is Nothing Then Throw New > ArgumentNullException("newCursor") > m_previous = Cursor.Current > m_newCursor = newCursor > Cursor.Current = m_newCursor > End Sub > > Public Sub Restore() > Cursor.Current = m_newCursor > End Sub > > Public Sub Dispose() Implements IDisposable.Dispose > Cursor.Current = m_previous > End Sub > > End Class > > To use it I simply: > > Using wc As New WaitCursor() > ' do work here > End Using > > Using will automatically call the WaitCursor.Dispose method that reverts > the > cursor to what it was. You can use the overload New if you want a cursor > other then a WaitCursor... > > -- > Hope this helps > Jay [MVP - Outlook] > .NET Application Architect, Enthusiast, & Evangelist > T.S. Bradley - http://www.tsbradley.net > > > " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message > news:efOKk4BJGHA.1188@TK2MSFTNGP14.phx.gbl... > | > > | > If you "need" the pseudo recursion, try: > | > > | > For Each C1 As Control In c.Controls > | > For Each C2 As Control In C1.Controls > | > For Each C3 As Control In C2.Controls > | > C3.Cursor = Cursors.WaitCursor > | > Next C3 > | > C2.Cursor = Cursors.WaitCursor > | > Next C2 > | > C1.Cursor = Cursors.WaitCursor > | > Next C1 > | > > | > > | > -- > | Is there recursion in the above? > | I believe it is called with c referencing a usercontrol that contains > many > | controls on it, so as to set the cursor for all of them. > | > | Also, do I need to reset the cursor? > | I think I remember a case where a Sub set the cursor, called another Sub > | that also set the cursor and then reset it to default which negated the > | effect of the first Sub's set. > | Is this the way it works. > | How to get around it? > | > | > | Thanks for the help > | > | > > **Developer**,
In addition to the other comments. As you may this is a new warning that is intended to let you know of potentially confusing code, such as code like: Dim aThread As New System.Threading.Thread(AddressOf ThreadProc) aThread.Start() aThread.Sleep(TimeSpan.FromSeconds(5)) Which Thread is going to sleep for 5 seconds? Remember Thread.Sleep is a shared method that operates on the CurrentThread. | Warning 153 Access of shared member, constant member, enum member or Are all 153 referring to DialogResult?nested | type through an instance; qualifying expression will not be evaluated. You could use "Project - Properties - Compile" to change the "Instance variable accesses shared member" from Warning to None. However I would only change it temporarily to simplify changing other errors & warnings. Once the other errors & warnings are taken care of I would turn the warning back on & address the issues... -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message news:OrvAdO3IGHA.2064@TK2MSFTNGP09.phx.gbl... | If e.Button = MouseButtons.Left Then | | also from a | | Dim Answer As DialogResult = MessageBox.Show.. | | Select Case Answer | | Case DialogResult.Yes | | and many other uses of an enum I get | | Warning 153 Access of shared member, constant member, enum member or nested | type through an instance; qualifying expression will not be evaluated. | | | | Why not. What's the problem using a enum like this? | | | | | | Thanks, I can fix it now!
Show quoteHide quote " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message news:OrvAdO3IGHA.2064@TK2MSFTNGP09.phx.gbl... > If e.Button = MouseButtons.Left Then > > also from a > > Dim Answer As DialogResult = MessageBox.Show.. > > Select Case Answer > > Case DialogResult.Yes > > and many other uses of an enum I get > > Warning 153 Access of shared member, constant member, enum member or > nested type through an instance; qualifying expression will not be > evaluated. > > > > Why not. What's the problem using a enum like this? > > > > > >
Converted a solution to VS2005 and it is complaining: Variable 'PF2' is used before it has been assi
Problem with installer made in VS 2003.NET setting datagrid column widths in code? Detect Concurrent Running Instances Inheritance and function issue FileDownload with WebBrowser Control - disable the Save? How do I maintain paragraph numbers into a new word document write Override methods in Code Editor VS2005 Run from Server or Workstation |
|||||||||||||||||||||||