yeewee64
asked on
Merging C# and VB.NET projects
Hi experts,
I have two Windows app projects, one written in C# and another written in VB.NET. Is it possible to combine these 2 projects?
I know we can add multiple projects under the same solution but what I want to do is really calling forms in C# project from VB project. If it's possible, may I know how to do it? Using DLL?
Thanks!
I have two Windows app projects, one written in C# and another written in VB.NET. Is it possible to combine these 2 projects?
I know we can add multiple projects under the same solution but what I want to do is really calling forms in C# project from VB project. If it's possible, may I know how to do it? Using DLL?
Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
that is obvious Bob,
but you can instantiate forms written in c# in the vb.net project using vb.net syntax
but you can instantiate forms written in c# in the vb.net project using vb.net syntax
Sometimes, though, you gotta state the obvious, because it is not always so obvious to everyone. :)
Bob
Bob
that, I must give you, is so true!
well one more thing, it has to follow CLS standards to call VB.NET object from C# and vice versa!!
ASKER
Hi guys, thanks for your prompt reply.
BTW, b1xml2, I tried to follow your instructions but I don't know how to do this step "Add the c# project reference to the VB project". I tried to bring up the "Add Reference" dialog in the VB project, and then clicked the "Project" tab, from there I selected the C# project. When I clicked OK, I was given an error message saying "A reference to ... could not be added. An assembly must have a 'dll' extension in order to be referenced".
Did I add reference the right way?
BTW, b1xml2, I tried to follow your instructions but I don't know how to do this step "Add the c# project reference to the VB project". I tried to bring up the "Add Reference" dialog in the VB project, and then clicked the "Project" tab, from there I selected the C# project. When I clicked OK, I was given an error message saying "A reference to ... could not be added. An assembly must have a 'dll' extension in order to be referenced".
Did I add reference the right way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, I've done a simple test, create a form in C# class library project and then instantiate the form from another VB project, it works.
So is this the way you guys are referring to? Or did I understand wrongly?
Somehow I got the impression that VB and C# can work together pretty well so I thought they could be integrated without using DLL. :)
Anyway, converting the C# project to VB or vice versa is not a huge task, I'm just trying to avoid rewriting codes.
So is this the way you guys are referring to? Or did I understand wrongly?
Somehow I got the impression that VB and C# can work together pretty well so I thought they could be integrated without using DLL. :)
Anyway, converting the C# project to VB or vice versa is not a huge task, I'm just trying to avoid rewriting codes.
Until I can figure out how to make a project reference to an EXE, I think that the only way that you are going to get this to work is to convert one of the projects to a DLL and go from there.
Bob
Bob
only dlls would work, You could in any .NET project load an exe but you then have to pass in external args... not the same of course as referencing an assembly
ASKER
OK, thanks guys for all your comment.
Bob