473,396 Members | 2,024 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,396 software developers and data experts.

How to connect two classes in a namespace?

I have a solution with a project names
ProjA and ProjB. In ProjA i have a class
called ClassA. It contains a static,
public member MembA.

I'd like to read MembA when executing
code in class ClassB in the project
ProjB, but when i try the following, i
get nothing from Intellisense (and it
doesn't compile either).

ClassA.MembA = null;

The error is as follows.
"The type or namespace name 'ClassA' could
not be found (are you missing a using
directive or an assembly reference?)"

However, them being in the same namespace
mean that they know about eachother,
doesn't it?

Or is it required to reference projects
in the same namespace and the same solution?!

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 18 '08 #1
6 2315
If they are different project, then a reference will be needed to see
the other type. Note that you should avoid circular references (A
references B and B references A) - in fact, the IDE won't let you do
this [you can do it at the command line if you try hard enough].

Marc
Sep 18 '08 #2
If they are different project, then a reference will be needed to see the
other type.
When i tried adding the project as a
reference, i got a lot of errors about
XML files mentioned in ClassA.exe.manifest
but not being found. Any thoughts?

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 18 '08 #3
Not without more info - but the simplest answer here is to put the
shared types into a dll, and reference that dll from both projects.
References to exes are possibly, but aren't as well supported (VS2005
didn't support it at all IIRC).

Marc
Sep 18 '08 #4
Hmm... It seems you're thinking "types" as
in "classes". However, the problem i ran
into was that the manifest file complained
about XML files (normal data, nothing
fancy) being not found.

I solved it by referencing the executble
directly, instead of the project but i'm
unsure if that's a good solution (or a
solution at all). This area isn't exactly
my forte.

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
"Marc Gravell" <ma**********@gmail.comskrev i meddelandet
news:%2******************@TK2MSFTNGP05.phx.gbl...
Not without more info - but the simplest answer here is to put the shared
types into a dll, and reference that dll from both projects. References to
exes are possibly, but aren't as well supported (VS2005 didn't support it
at all IIRC).

Marc

Sep 18 '08 #5
On Sep 18, 1:13*pm, "K Viltersten" <t...@viltersten.comwrote:
If they are different project, then a reference will be needed to see the
other type.

When i tried adding the project as a
reference, i got a lot of errors about
XML files mentioned in ClassA.exe.manifest
but not being found. Any thoughts?
Can you give the exact error message, please, along with the content
of the .manifest?
Sep 18 '08 #6
>>If they are different project, then a
>>reference will be needed to see the
other type.

When i tried adding the project as a
reference, i got a lot of errors about
XML files mentioned in ClassA.exe.manifest
but not being found. Any thoughts?

Can you give the exact error message,
please, along with the content of the
.manifest?
It was in swedish, so no, but it said that
the file ThisAndThat.XML mentioned in
ThatRunnable.exe.manifest couldn't be
located.

Right now, i referenced the EXE file hoping
that it's good enoough.

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 18 '08 #7

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

Similar topics

49
by: Christopher J. Bottaro | last post by:
I find myself doing the following very often: class Struct: pass .... blah = Struct() blah.some_field = x blah.other_field = y ....
45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
3
by: cocla | last post by:
I try to connect to server using following codes: (smart device application) Socket s=new Socket(); try { s.connect(host);//host is an object of IPEndPoint class } catch (SocketException) {
11
by: C# Learner | last post by:
Is it not possible to declare a nested class in a seperate file from its "parent" class -- i.e. in a similar way to the idea of spreading namespaces over more than one file?
3
by: Jassim Rahma | last post by:
I would like to know what is the best way to onnect to connect to a database in general which provides you with full functionality & fast access? Best Regards, Jassim Rahma *** Sent via...
3
by: mikeg | last post by:
When I try to connect to an SQL Server developer edition database using server explorer in vb.net standard I get the following message: Unable to connect to database. It is only possible to...
16
by: tshad | last post by:
This is a little complicated to explain but I have some web services on a machine that work great. The problem is that I have run into a situation where I need to set up my program to access one...
12
by: Nathan Sokalski | last post by:
I have several CustomControls that I have written for my project. However, when I try to compile I recieve the following warning & errors: Warning 32 Could not resolve this reference. Could not...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.