Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB.NET
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
Edited 4-May-11 20:47pm
v2
Rate this: bad
good
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.
  Permalink  
Comments
SAKryukov at 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
Rate this: bad
good
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.
  Permalink  
Comments
SAKryukov at 5-May-11 17:33pm
   
A vote of 3 for this answer is simply hostile -- what's wrong? I voted 5.
--SA
Rate this: bad
good
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 vb.net application[^].
 
—SA
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,656
1 Sergey Alexandrovich Kryukov 6,490
2 CPallini 5,310
3 George Jonsson 3,584
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web03 | 2.8.140921.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
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