|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
.NET 2.0 Conversion Wizard Flags Me.Cursor?Hi
As per subject when using the converter wizard in vs2005 to convert vb 1.1 to 2.0 code i get warnings (lots of them) about silly stuff like Me.Cursor.Current. It says Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. How does me.cursor qualify for this treatment and what does it mean if i choose to do nothing about it. The code compilies fine. Thanks Lenny VB allows you to access a shared method with an instance - in your example
"Me" is the instance. The "Cursor" property is a shared property however, so there's no need to use an instance - just use the class. VS is simply informing you that the "Me" will not be evaluated - useless message in this case, but if your instance term was more complicated then it could be informative. Accessing shared members via an instance is sloppy. I think the warning is there now to gradually wean people off the practice since perhaps Microsoft will remove this capability in VB in the future? (just guessing) -- Show quoteHide quoteDavid Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter & VB to C++ converter Instant J#: VB to J# converter "Learnicus" wrote: > Hi > > As per subject when using the converter wizard in vs2005 to convert vb 1.1 > to 2.0 code i get warnings (lots of them) about silly stuff like > Me.Cursor.Current. > > It says > > Access of shared member, constant member, enum member or nested type through > an instance; qualifying expression will not be evaluated. > > How does me.cursor qualify for this treatment and what does it mean if i > choose to do nothing about it. The code compilies fine. > > Thanks > > Lenny > > > Lenny,
Since Current is a shared property of the Cursor class, you just need to use Cursor.Current instead of your form's instance of the Cursor class. Kerry Moorman Show quoteHide quote "Learnicus" wrote: > Hi > > As per subject when using the converter wizard in vs2005 to convert vb 1.1 > to 2.0 code i get warnings (lots of them) about silly stuff like > Me.Cursor.Current. > > It says > > Access of shared member, constant member, enum member or nested type through > an instance; qualifying expression will not be evaluated. > > How does me.cursor qualify for this treatment and what does it mean if i > choose to do nothing about it. The code compilies fine. > > Thanks > > Lenny > > > Thats excellent. Thanks you both.
I got a bit confused because prior to posting I looked up the status of the System.Form.Cursor. This is an overridable instance property not a shared property so i couldn't figure out what VS was on about. I couldn't work out why this was flagged given that Me is an instance and so is Me.Cursor... anyways got it now. Any idea how to turn these green under line sqiggles warnings off, i looked in Tools/Options and im showing all settings but i cant see the option. I'll deal with it later but for now i dont want the distraction. Thanks Lenny Show quoteHide quote "Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message news:5D9947B1-76FC-4868-A0DA-B486B0043476@microsoft.com... > Lenny, > > Since Current is a shared property of the Cursor class, you just need to > use > Cursor.Current instead of your form's instance of the Cursor class. > > Kerry Moorman > > > "Learnicus" wrote: > >> Hi >> >> As per subject when using the converter wizard in vs2005 to convert vb >> 1.1 >> to 2.0 code i get warnings (lots of them) about silly stuff like >> Me.Cursor.Current. >> >> It says >> >> Access of shared member, constant member, enum member or nested type >> through >> an instance; qualifying expression will not be evaluated. >> >> How does me.cursor qualify for this treatment and what does it mean if i >> choose to do nothing about it. The code compilies fine. >> >> Thanks >> >> Lenny >> >> >>
Show quote
Hide quote
"Learnicus" <spamthis@nospam.com> schrieb You can change it in the project's properties.> Thats excellent. Thanks you both. > > I got a bit confused because prior to posting I looked up the status > of the System.Form.Cursor. This is an overridable instance property > not a shared property so i couldn't figure out what VS was on about. > I couldn't work out why this was flagged given that Me is an > instance and so is Me.Cursor... anyways got it now. > > Any idea how to turn these green under line sqiggles warnings off, i > looked in Tools/Options and im showing all settings but i cant see > the option. I'll deal with it later but for now i dont want the > distraction. Armin
How to put all code generated by the designer in external files (VS2005) ?
Simple Graphics Question Custom DataGRidComboBoxStyle DataSource Problems Fill a tree view with a stored procedure Setting an object to a UserControl How to use a PDB file login/users/roles in ASP.Net? httpwebrequest Debugging design-time features of custom control ASP.Net and Flash |
|||||||||||||||||||||||