VB to C#

M

Miro

I have a question.

Currently my Visual Studios 2008 has its main language and setup setup as
vb.net

I want to ( temporarily ) switch it to compile and do things as if it was a
C# or C++ compiler and work area.

What would I need to change to do this?

and then change it back?

-Or is this even possible
Thanks,

Miro
 
S

Scott M.

When you create a new project, you can choose the language you wish the new
project to be in. After that choice is made, that project will compile
using the correct compiler.

So, all you have to do is make a new project, but select from the "other
languages" node of the new project dialog box.

If you want the language change to be more perminent, go to the Tools menu
and choose "Import and Export Settings". Then choose "Reset all settings",
then close Visual Studio and re-open it. When it re-opens, you'll be able
to select the primary programming language.

-Scott
 
M

Miro

Thank you,

I was trying to do it within a project already open and could not find a
"switch" button.

Creating a 'new project' was exactly what I was looking for.

Thank you,

Miro
 
S

Scott M.

You cannot switch languages within a project because the various items in
your project compile down to a single assembly file. As such all items
within a single project must use a single .NET language.

You could have one solution that contains different projects and each
project could be written in a different .NET language.

-Scott
 
M

Miro

Thats perfect.
-I'm to new to visual studios still to know - but I thought there was a way
to have a c# class called by vb.net
( i know if a class is written in vb.net you shouldnt use "optional"
paramters ), but with my top statement, im assuming by your reply that that
class must be in a C# project to be called?

I am expecting to get some code from someone that will be in C# to try to
debug it, and I was just getting ready to see how to 'open' and play with
the c# files.

I dont plan to re-write it ( maybe fix it ) but at least debug it to where
the problem lies.

Thanks for all your help.

Miro
 
S

Scott M.

A C# assembly can be called from a VB .NET assembly (and vice versa), but C#
source code cannot be called by VB .NET source code (and vice versa).

This is why (if you want to do this), you need to have 2 different projects
in one solution. Each project compiles down to its own assembly, and thus a
class in one assembly can be used by another assembly (after the first
assembly makes a reference to the other).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top