473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Specifiy that i'm referring to a class, not a member

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

Sep 21 '06 #1
4 940

<wi******@yahoo.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.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
Sep 21 '06 #2
That's great, didn't know you could do that :)

Thanks Mythran!

Phil

Mythran wrote:
<wi******@yahoo.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.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
Sep 21 '06 #3

wi******@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) ...

>
Mythran wrote:
<wi******@yahoo.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.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
Sep 21 '06 #4

<za***@construction-imaging.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>
wi******@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) ...

Usually, we don't do that in our office. But once in a great while, there
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
Sep 21 '06 #5

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

Similar topics

8
by: Webster | last post by:
Hello, I have a class Shape and subclasses Circle, Rectangle etc. I also have a function to write them to a file given a filepointer. However, I store the colour info in the Shape class. My...
4
by: Jian H. Li | last post by:
Hello, What's the essential differences between the two ways of "class::member" & "object.member"(or object_pointer->member)? class C{ public: void f() {} int i; };
5
by: kuvpatel | last post by:
Hi I want to refer a class called LogEvent, and use one of its methods called WriteMessage without actually having to create an instance of Logevent. I have tried using the word sealed with...
60
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
2
by: Jerry Spence1 | last post by:
One way of passing data to a thread is to encapsulate the thread inside a class. However, I can't refer to my main form objects from within the class/thread as it says "Reference to a non-shared...
8
by: toton | last post by:
Hi, I am facing problem some times, and not finding a suitable answer to solve it. I have a vector (or some other container, sometimes) of some class, named CC like vector<CCv, NOT vector<CC*; ...
11
by: edson | last post by:
Greetings For certain operations I would like to have easy access to struct members. Here is an example. struct mystruct { char member1; char member2; char member3; };
15
by: akomiakov | last post by:
Is there a technical reason why one can't initialize a cost static non- integral data member in a class?
4
by: Dave Burns | last post by:
Hello, I am trying to specify a logical default value for a in a WCF Web Service using basicHttpBinding. I realize that the language defaults are: int - 0 string - null bool - false
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
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...

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.