Click here to Skip to main content
13,006,730 members (61,683 online)
Rate this:
Please Sign up or sign in to vote.
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 4-May-11 20:46pm
Updated 4-May-11 20:47pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
SAKryukov 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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
SAKryukov 5-May-11 17:33pm
A vote of 3 for this answer is simply hostile -- what's wrong? I voted 5.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I just answered a similar question, please see:
how to merge c# application to a application[^].


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170628.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100