Vb.NET and C# in one Project!?!

gicio

Regular
Joined
Aug 26, 2002
Messages
90
Hi!

I have get a VB.NEt project. I add to this project my
C# project. I set my C# project as Startup. But me C# can't see the
VB.NEt project!
what I should do that my C# project can see the VB.NET project.
(now are the both projects in one solution).


gicio
 
the project isn't a .dll ...it's a .exe (it's a project with forms)

can I make a .dll from a project with forms?

when YES....HOW??


thx!


gicio
 
Just create a new Class Library project and copy all your code files into it, you shouldnt have any problems. Then when you do that, you can add a reference to that DLL from your other Windows Forms app.
 
gicio said:
must have the both project the same namespace???


gicio

How to put both the projects in the same namespace.Please expalin clearly as i tried it but did not suceed.Urgent Requirement

Thanx
 
You don't really need them in the same namespace. Here's what you can do though.

Assuming you have Solution named Project1 with a project WinExe1. Also assume you have another solution with a project WinExe2. Now suppose you want the forms from WinExe2 to be available in WinExe1:

1. Open your solution for WinExe1 and right click the solution and select Add Existing project. Select your WinExe2 project.
2. Right click your WinExe2 project and click properties. Change the project type from Windows Executable to Class Library.
3. Expand the references node for WinExe1 and click Add Reference. Select the Projects tab and select the WinExe2 project.

Now in your WinExe1 project, add something like:
Imports WinExe2
to the top of one of your classes. Import whatever namespace you used in the second project. Now that class in WinExe1 should be able to create an object from WinExe2, including forms.

The two keys are keeping the projects in one solution and making sure the second project is a Class Library. You can always switch it back to a Windows Exe for testing separately later - I do that all the time.

-Ner
 
Back
Top