DreamKid Posted August 3, 2005 Posted August 3, 2005 How can I implement C# and VB.Net in a same project? Quote
Administrators PlausiblyDamp Posted August 3, 2005 Administrators Posted August 3, 2005 From Visual Studio you can't, however using the command line tools it's possible to compile both vb and C# code to a module and then link multiple modules into a single assembly. Is there a reason why you need to use both languages in a single project? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
DreamKid Posted August 3, 2005 Author Posted August 3, 2005 From Visual Studio you can't, however using the command line tools it's possible to compile both vb and C# code to a module and then link multiple modules into a single assembly. Is there a reason why you need to use both languages in a single project? It's a requirement of the assignment. How do I compile in command line tools? Quote
VagabondSW Posted August 3, 2005 Posted August 3, 2005 How can I implement C# and VB.Net in a same project? If you have Visual Studio .NET, you should be able to do that using a multi-project solution. If you right click the Solution in the Solution Explorer, you have the option of adding a new or existing project to the solution. That project could be either a VB.NET or C#.NET project. After adding that project, right-click References in the Solution Explorer and select Add Reference. Now click the Projects tab and Select the project you just added to the solution. So, if I have a C# Windows Application Solution, I could add a VbMessage Class Library Project that may have a Message Property of "Hello World". After adding the VbMessage Project to my References, I could have the following code a button Click event in my C# Windows Application (this is untested psuedo-code): VbMessage vbmsg = new VbMessage() textBox1.Text = vbmsg.Message You are now "consuming" a VB class in your C# solution. Quote "Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
VagabondSW Posted August 3, 2005 Posted August 3, 2005 I just re-read the thread and realized you are trying to do this in the same Project rather than the same Solution. Sorry, I'm a little slow. Quote "Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.