|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Specifiy that i'm referring to a class, not a memberHi all,
I've got a class in my project called Location - it has some shared members that I can't reference from within a form because forms have a property called location. Short fo renaming the class or putting Projectname.Location.Member which is a bit wordy for my liking, how can I tell the compiler I'm talking about the Location class, not the Location member? I'm using VS 2003. Thanks very much for any help you can offer, Phil <wingp***@yahoo.com> wrote in message
Show quoteHide quote news:1158851454.566290.278200@d34g2000cwd.googlegroups.com... You could use "Imports MyLoc = MyNamespace.Location". Then you could use > Hi all, > > I've got a class in my project called Location - it has some shared > members that I can't reference from within a form because forms have a > property called location. Short fo renaming the class or putting > Projectname.Location.Member which is a bit wordy for my liking, how can > I tell the compiler I'm talking about the Location class, not the > Location member? I'm using VS 2003. > > Thanks very much for any help you can offer, > > Phil > MyLoc.MemberHere :) HTH, Mythran That's great, didn't know you could do that :)
Thanks Mythran! Phil Mythran wrote: Show quoteHide quote > <wingp***@yahoo.com> wrote in message > news:1158851454.566290.278200@d34g2000cwd.googlegroups.com... > > Hi all, > > > > I've got a class in my project called Location - it has some shared > > members that I can't reference from within a form because forms have a > > property called location. Short fo renaming the class or putting > > Projectname.Location.Member which is a bit wordy for my liking, how can > > I tell the compiler I'm talking about the Location class, not the > > Location member? I'm using VS 2003. > > > > Thanks very much for any help you can offer, > > > > Phil > > > > You could use "Imports MyLoc = MyNamespace.Location". Then you could use > MyLoc.MemberHere :) > > HTH, > Mythran wingp***@yahoo.com wrote:
> That's great, didn't know you could do that :) I use that same trick to provide shortcut references to VB functions as> > Thanks Mythran! > > Phil in: Imports VB = MicrosoftVisualBasic If VB.Left(blah) ... Show quoteHide quote > > Mythran wrote: > > <wingp***@yahoo.com> wrote in message > > news:1158851454.566290.278200@d34g2000cwd.googlegroups.com... > > > Hi all, > > > > > > I've got a class in my project called Location - it has some shared > > > members that I can't reference from within a form because forms have a > > > property called location. Short fo renaming the class or putting > > > Projectname.Location.Member which is a bit wordy for my liking, how can > > > I tell the compiler I'm talking about the Location class, not the > > > Location member? I'm using VS 2003. > > > > > > Thanks very much for any help you can offer, > > > > > > Phil > > > > > > > You could use "Imports MyLoc = MyNamespace.Location". Then you could use > > MyLoc.MemberHere :) > > > > HTH, > > Mythran <za***@construction-imaging.com> wrote in message
Show quoteHide quote news:1158853552.850740.136330@e3g2000cwe.googlegroups.com... Usually, we don't do that in our office. But once in a great while, there > > wingp***@yahoo.com wrote: >> That's great, didn't know you could do that :) >> >> Thanks Mythran! >> >> Phil > > I use that same trick to provide shortcut references to VB functions as > in: > > Imports VB = MicrosoftVisualBasic > > If VB.Left(blah) ... > > comes a time where two namespaces collide. For example: SomeCompany.Security.Principal namespace, System.Security.Principal namespace and OurCompany.Security.Principal namespace. We don't want to type out the full namespace, so we just use the specified imports shortcut. Another thing that we usually don't use, but have done...albeit rarely, is import a class directly so that we don't have to type out the class name.... Example: We have a class named Common with all shared members. We just want to call the members/methods directly without specifying Common everywhere... (this only works in VB.Net and not C# afaik)... Imports OurNamespace.OurApplication.Common Here we directly import the namespace + classname and now instead of Common.MethodName() we can just use MethodName() ... Cheers! Mythran
Problem calling a Sub in another form
WebBrowser - Excel processs till running Random Numbers Not Being Random Why is PeekChar causing a problem? Q: Copying part of a table Write commands to the COM port PrintDocument and HasMorePages issue TextFieldParser - reading tab delimited file Refresh/Blinking Problems with VB.NET Application Calling Subprocedures |
|||||||||||||||||||||||