Jump to content
Xtreme .Net Talk

Recommended Posts

  • Administrators
Posted

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?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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?

Posted
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.

"Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
Posted
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.
"Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...