473,396 Members | 1,864 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.

Q: Simple question???

Hi

I have two projects within a solution in Visual Studio .NET 2003. How do I
access the code in one from the other? For example, there is a public member
in one project. How can I call it from the other form? When I try to do this
it says that the member is not declared.

Geoff
Nov 21 '05 #1
9 900
Geoff,

Add a reference to the project, if the public member is a property or method
of a public class then you should not have a problem accessing it.

Dan

"Geoff Jones" <no********@email.com> wrote in message
news:41*********************@news.dial.pipex.com.. .
Hi

I have two projects within a solution in Visual Studio .NET 2003. How do I
access the code in one from the other? For example, there is a public member in one project. How can I call it from the other form? When I try to do this it says that the member is not declared.

Geoff

Nov 21 '05 #2
If you want to share code at source code level, that is, one project
"borrows" files of source code from the other, you must link the file using
"Add Existing Item..." menu and in the file dialog, select the file, drop
down the Open button and select Link File.

If you want to share code at binary (compiled) level, one of the projects
must be a Class Library and must be referenced by the other, using "Add
Reference..." menu, Project tab.

--

Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
"Geoff Jones" <no********@email.com> escribió en el mensaje
news:41*********************@news.dial.pipex.com.. .
Hi

I have two projects within a solution in Visual Studio .NET 2003. How do I
access the code in one from the other? For example, there is a public
member in one project. How can I call it from the other form? When I try
to do this it says that the member is not declared.

Geoff

Nov 21 '05 #3
Hi

The code I'm trying to access is another form i.e. they are both forms. When
I try to Add Reference there doesn't seem to be anything to add.

Can you give any further help?

Geoff

"Carlos J. Quintero [.NET MVP]" <ca*****@NOSPAMsogecable.com> wrote in
message news:ef**************@TK2MSFTNGP10.phx.gbl...
If you want to share code at source code level, that is, one project
"borrows" files of source code from the other, you must link the file
using "Add Existing Item..." menu and in the file dialog, select the file,
drop down the Open button and select Link File.

If you want to share code at binary (compiled) level, one of the projects
must be a Class Library and must be referenced by the other, using "Add
Reference..." menu, Project tab.

--

Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
"Geoff Jones" <no********@email.com> escribió en el mensaje
news:41*********************@news.dial.pipex.com.. .
Hi

I have two projects within a solution in Visual Studio .NET 2003. How do
I access the code in one from the other? For example, there is a public
member in one project. How can I call it from the other form? When I try
to do this it says that the member is not declared.

Geoff


Nov 21 '05 #4
Geoff,

Did you try the project add references and than the "Project" tab?

I hope this helps?

Cor
"Geoff Jones" <no********@email.com>
Hi

I have two projects within a solution in Visual Studio .NET 2003. How do I
access the code in one from the other? For example, there is a public
member in one project. How can I call it from the other form? When I try
to do this it says that the member is not declared.

Geoff

Nov 21 '05 #5
Yes, but I couldn't see what to add

Geoff

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Od******************@TK2MSFTNGP12.phx.gbl...
Geoff,

Did you try the project add references and than the "Project" tab?

I hope this helps?

Cor
"Geoff Jones" <no********@email.com>
Hi

I have two projects within a solution in Visual Studio .NET 2003. How do
I access the code in one from the other? For example, there is a public
member in one project. How can I call it from the other form? When I try
to do this it says that the member is not declared.

Geoff


Nov 21 '05 #6
"Geoff Jones" <no********@email.com> schrieb:
Yes, but I couldn't see what to add


In VB 2003, you can only add references to projects that are not Windows
Application projects. So you will have to make the code used by other
applications part of a class library project in order to be able to
reference it.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Geoff,

\\\
I made a new project
I added to that a new project
In that added project I changed in the properties the output type in the box
general to "class library"
Than I renamed the name of that form in that project to Geoff and the text
of the form as well
Than I did when I had again selected the first project, project -> add
reference -> with a a reference to the second project
I made an import to the second project on the form of the first project
Than I made a load event with in that
dim frm as new Geoff
frm.showdialog
Than I started debug
And than I saw Geoff
////

Maybe gives this a lead

Cor
"Geoff Jones" <no********@email.com>
Yes, but I couldn't see what to add

Geoff

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Od******************@TK2MSFTNGP12.phx.gbl...
Geoff,

Did you try the project add references and than the "Project" tab?

I hope this helps?

Cor
"Geoff Jones" <no********@email.com>
Hi

I have two projects within a solution in Visual Studio .NET 2003. How do
I access the code in one from the other? For example, there is a public
member in one project. How can I call it from the other form? When I try
to do this it says that the member is not declared.

Geoff



Nov 21 '05 #8
Many thanks Cor

Geoff

"Cor Ligthert" <no************@planet.nl> wrote in message
news:O%****************@TK2MSFTNGP09.phx.gbl...
Geoff,

\\\
I made a new project
I added to that a new project
In that added project I changed in the properties the output type in the
box general to "class library"
Than I renamed the name of that form in that project to Geoff and the text
of the form as well
Than I did when I had again selected the first project, project -> add
reference -> with a a reference to the second project
I made an import to the second project on the form of the first project
Than I made a load event with in that
dim frm as new Geoff
frm.showdialog
Than I started debug
And than I saw Geoff
////

Maybe gives this a lead

Cor
"Geoff Jones" <no********@email.com>
Yes, but I couldn't see what to add

Geoff

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Od******************@TK2MSFTNGP12.phx.gbl...
Geoff,

Did you try the project add references and than the "Project" tab?

I hope this helps?

Cor
"Geoff Jones" <no********@email.com>

Hi

I have two projects within a solution in Visual Studio .NET 2003. How
do I access the code in one from the other? For example, there is a
public member in one project. How can I call it from the other form?
When I try to do this it says that the member is not declared.

Geoff



Nov 21 '05 #9
Compile the project with the variable and add a reference to it in the
other project. Instantiate the other class and access the variable with
the object. Simple!

with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #10

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

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
1
by: Proteus | last post by:
Any help appreciated on a small perl project I need to write for educator/teaching purposes. I have not programmed perl for some time, need to get up to speed, maybe some kind souls hrere will help...
2
by: Raskolnikow | last post by:
Hi! I have a very simple problem with itoa() or the localtime(...). Sorry, if it is too simple, I don't have a proper example. Please have a look at the comments. struct tm *systime; time_t...
3
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
14
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
10
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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
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,...

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.