473,786 Members | 2,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2325
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.mani fest
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**********@g mail.comskrev i meddelandet
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
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...@vilterste n.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.mani fest
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.mani fest
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.ex e.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
2839
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
3628
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 themselves are an exception to this), and 'bootstrap' your program by instantiating a single application object in main(), would that place any limitations on what you could accomplish with your program? Are there any benefits to doing things that...
3
5587
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
2729
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
4568
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 Developersdex http://www.developersdex.com ***
3
1537
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 connect to SQL Server Desktop Engine databases ..with this version of Visual Studio Is there any way around this. I would like Vb.net to talk to sql sever. maybe an upgrade is needed? Thanks,
16
2382
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 or another (could also be 3) different web servers to use these Web Services. The Web Services are identical on all the machines. I tried just changing the URL of the Web Services and cannot make it work. I then decided to create 2 identical web...
12
2046
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 locate the assembly "nathansokalski_com_test, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors....
12
11111
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. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
0
9650
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7515
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.