Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi coders,
In my windows application, i have a VB.NET project. In that, i need to include an image capturing from some device. I have source code for that device which is in C#.Net...

How can i add both in a single project??

I can run both applications(C# and VB) side by side. But the problem is, i need to save that image in the name of an "ID" generated in VB.NET project. I just want that ID alone inside my C# project.
Is there any idea to toggle my problem??
Suggestions welcomes...
Posted
Updated 4-May-11 20:47pm
v2

Probably need one solution with two projects in it - one C#, the other VB. If, say, VB project is your main app and C# project compiles to a class library, you should be able to add a reference to the C# project to your VB project and then make calls from VB code to C# code very easily (so method in C# that has ID as one of its arguments so that you can pass the parameter from VB - or get C# to capture image and return it and let VB sort out saving it appropriately). Define the namespaces in each project properly and, add the relevant Imports statements to your VB code to reference the C# project namespace.

AFAIK you can't mix VB and C# in the same project.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 5-May-11 17:32pm    
Correct, my 5. Notes: 1) OP ***certainly*** needs separate projects, 2) name spaced do not really mean much, could be the exactly the same in different projects, different name space in the same project, etc. It is important for convenience.
--SA
Extract the VB code into a new DLL project, leaving the VB user interface the same.
You can then call the functions in the DLL from both the VB program and the C#.

To do this:
1) Right click your solution in the Solution Explorer pane.
2) Select Add..New Project
3) Select Project type as "Class library" from the VB list.
4) Set the name appropriately.
5) Press OK.

Import the code, and off you go - you will have to add a reference to the DLL project namespace in both your VB and C# projects and so forth.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 5-May-11 17:33pm    
A vote of 3 for this answer is simply hostile -- what's wrong? I voted 5.
--SA
I just answered a similar question, please see:
how to merge c# application to a vb.net application[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900