Q: Simple question???

  • Thread starter Thread starter Geoff Jones
  • Start date Start date
G

Geoff Jones

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
 
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
 
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.
 
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
 
Geoff,

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

I hope this helps?

Cor
 
Yes, but I couldn't see what to add

Geoff

Cor Ligthert said:
Geoff,

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

I hope this helps?

Cor
 
Geoff Jones said:
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.
 
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
 
Many thanks Cor

Geoff

Cor Ligthert said:
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top