473,385 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Mixing vb.net and C# in same project

Is it possible to add a vb.net source code module to a c#
project and if so how?

Thanks

Rudolf
Jul 19 '05 #1
4 23596
Hello Rudolf,

Thanks for posting in the group.

If you want to paste a VB code slice in C# file, I don't think that is
possible, since C# compiler won't compile VB code.

However, it is possible to use different languages in a single project. You
may need to write command line build file to build the project. In .NET
framework SDK, there is one sample on it. You could access it in C:\Program
Files\Microsoft Visual Studio
.NET\FrameworkSDK\Samples\Technologies\CrossDevLan guage.

This sample demonstrates the use different development languages in a
single project. This sample creates two assemblies. The first is a library
or DLL assembly that defines a simple base class written in managed
extensions for C++. The second assembly is an executable assembly that
defines three derived classes written in C#, VB, and IL (Intermediate
Language). These types derive from each other and ultimately from the base
class written in managed C++. Finally, the executable creates instances of
each of the derived types and calls a virtual method for each. The .NET
Framework is an environment where various developers can work together
seamlessly while developing in their language of choice.

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Rudolf" <Ru*****@hotmail.com>
!Sender: "Rudolf" <Ru*****@hotmail.com>
!Subject: Mixing vb.net and C# in same project
!Date: Thu, 4 Sep 2003 03:05:05 -0700
!Lines: 6
!Message-ID: <18****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNyzAOGCuM5l40bQCaPevCQHfcbMw==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107235
!NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Is it possible to add a vb.net source code module to a c#
!project and if so how?
!
!Thanks
!
!Rudolf
!

Jul 19 '05 #2
Thanks, I'll have a look at it

Rudolf
-----Original Message-----
Hello Rudolf,

Thanks for posting in the group.

If you want to paste a VB code slice in C# file, I don't think that ispossible, since C# compiler won't compile VB code.

However, it is possible to use different languages in a single project. Youmay need to write command line build file to build the project. In .NETframework SDK, there is one sample on it. You could access it in C:\ProgramFiles\Microsoft Visual Studio
.NET\FrameworkSDK\Samples\Technologies\CrossDevLa nguage.

This sample demonstrates the use different development languages in asingle project. This sample creates two assemblies. The first is a libraryor DLL assembly that defines a simple base class written in managedextensions for C++. The second assembly is an executable assembly thatdefines three derived classes written in C#, VB, and IL (IntermediateLanguage). These types derive from each other and ultimately from the baseclass written in managed C++. Finally, the executable creates instances ofeach of the derived types and calls a virtual method for each. The .NETFramework is an environment where various developers can work togetherseamlessly while developing in their language of choice.

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!Content-Class: urn:content-classes:message
!From: "Rudolf" <Ru*****@hotmail.com>
!Sender: "Rudolf" <Ru*****@hotmail.com>
!Subject: Mixing vb.net and C# in same project
!Date: Thu, 4 Sep 2003 03:05:05 -0700
!Lines: 6
!Message-ID: <18****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNyzAOGCuM5l40bQCaPevCQHfcbMw==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107235!NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Is it possible to add a vb.net source code module to a c#!project and if so how?
!
!Thanks
!
!Rudolf
!

.

Jul 19 '05 #3
Hello Rudolf,

You are welcome.

Thanks for participating the community.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Rudolf" <Ru*****@Hotmail.com>
!Sender: "Rudolf" <Ru*****@Hotmail.com>
!References: <18****************************@phx.gbl>
<PY**************@cpmsftngxa06.phx.gbl>
!Subject: RE: Mixing vb.net and C# in same project
!Date: Thu, 4 Sep 2003 06:00:54 -0700
!Lines: 85
!Message-ID: <0d****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNy5JNwVQFkpkT1Rd+pEkhBA8mf7w==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:107256
!NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Thanks, I'll have a look at it
!
!Rudolf
!
!>-----Original Message-----
!>Hello Rudolf,
!>
!>Thanks for posting in the group.
!>
!>If you want to paste a VB code slice in C# file, I don't
!think that is
!>possible, since C# compiler won't compile VB code.
!>
!>However, it is possible to use different languages in a
!single project. You
!>may need to write command line build file to build the
!project. In .NET
!>framework SDK, there is one sample on it. You could
!access it in C:\Program
!>Files\Microsoft Visual Studio
!>.NET\FrameworkSDK\Samples\Technologies\CrossDevL anguage.
!>
!>This sample demonstrates the use different development
!languages in a
!>single project. This sample creates two assemblies. The
!first is a library
!>or DLL assembly that defines a simple base class written
!in managed
!>extensions for C++. The second assembly is an executable
!assembly that
!>defines three derived classes written in C#, VB, and IL
!(Intermediate
!>Language). These types derive from each other and
!ultimately from the base
!>class written in managed C++. Finally, the executable
!creates instances of
!>each of the derived types and calls a virtual method for
!each. The .NET
!>Framework is an environment where various developers can
!work together
!>seamlessly while developing in their language of choice.
!>
!>Hope that helps.
!>
!>Best regards,
!>Yanhong Huang
!>Microsoft Online Partner Support
!>
!>Get Secure! - www.microsoft.com/security
!>This posting is provided "AS IS" with no warranties, and
!confers no rights.
!>
!>--------------------
!>!Content-Class: urn:content-classes:message
!>!From: "Rudolf" <Ru*****@hotmail.com>
!>!Sender: "Rudolf" <Ru*****@hotmail.com>
!>!Subject: Mixing vb.net and C# in same project
!>!Date: Thu, 4 Sep 2003 03:05:05 -0700
!>!Lines: 6
!>!Message-ID: <18****************************@phx.gbl>
!>!MIME-Version: 1.0
!>!Content-Type: text/plain;
!>! charset="iso-8859-1"
!>!Content-Transfer-Encoding: 7bit
!>!X-Newsreader: Microsoft CDO for Windows 2000
!>!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!>!Thread-Index: AcNyzAOGCuM5l40bQCaPevCQHfcbMw==
!>!Newsgroups: microsoft.public.dotnet.general
!>!Path: cpmsftngxa06.phx.gbl
!>!Xref: cpmsftngxa06.phx.gbl
!microsoft.public.dotnet.general:107235
!>!NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
!>!X-Tomcat-NG: microsoft.public.dotnet.general
!>!
!>!Is it possible to add a vb.net source code module to a
!c#
!>!project and if so how?
!>!
!>!Thanks
!>!
!>!Rudolf
!>!
!>
!>.
!>
!

Jul 19 '05 #4
In the App_Code subfolder you'll need to create 2 new subfolders, one for your C# classes and another for your VB.NET classes. After that you'll need to specify these 2 folders in the web.config in the <compilation> section like this:

<system.web>

<compilation debug="true">

<codeSubDirectories>

<add directoryName="CSharp"/>

<add directoryName="VB"/>

</codeSubDirectories>

</compilation>



</system.web>
Jul 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Saul Behr | last post by:
For all Microsoft's blah about C# and VB being completely mixable and interchangeable, I recommend for anyone who can still take this advice: DO NOT MIX VB AND C# PROJECTS IN THE SAME SOLUTION!...
4
by: Cristian Tota | last post by:
Hi, I'd appreciate any thoughts on mixing C++ and C code. I have a project that uses a given C interface, the rest of the project can be either in C or C++. What would be the recomended design...
2
by: Macca | last post by:
Hi, I will be starting a project that may need to use C# and C++ for different parts of the project. What is the best way to go about this? e.g which project type should i use and what issues...
9
by: Pascal Cloup | last post by:
Hello, I write a Dll of managed C++ class that contains a piece of code like the following liines. This code always fails when attempting to create a new not managed class. Someone has an...
6
by: Rudolf | last post by:
Is it possible to add a vb.net source code module to a c# project and if so how? Thanks Rudolf
0
by: Rob R. Ainscough | last post by:
I'm getting a bizarre error in the IDE Error List: ****** The Error message ******* Value of type 'MyDLL.Customer' cannot be converted to 'MyDLL.Customer'. Type mismatch could be due to the...
28
by: ziman137 | last post by:
Hello all, I have a question and am seeking for some advice. I am currently working to implement an algorithmic library. Because the performance is the most important factor in later...
3
by: Jose Manuel vilomar | last post by:
Hi and thx for take a litle time to reply me. My question is: Supposing that i have a Control built in ASP 3.0 (a Calendar Control in this case) and I want to make it work in a .Net project...
3
by: jason | last post by:
I've been working with C# for over a year now without touching vb.net code. I had a few light years of vb.net before that. No real vb6 or windows form experience. Suddenly, I have an assignment...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.