CS and VB in same project

  • Thread starter Thread starter rooster575
  • Start date Start date
R

rooster575

Is it possible to have a .cs file that references classes created in .vb all
within the same project[web app]?

I would like to start using cSharp, but the rest of the project is in vb and
the 2 cant seem to coexist.

Thanks.
 
application is bound to a particular language.
ie you cannot have vb.net and c# in the same application
however you can create a new application and add it to your current
solution, in which case you can choose whatever language you prefer.
or you can write your code as an assembly and use that within the vb project
if that helps.
 
Microsoft supports having mixed languages within the same solution, but not
within the same project.
So for example you could create a component in C# and then use it from a VB
application, or vice-versa.
 
You might want to start with a more flexible design for your application.

Create a class library project in C# and then reference that in the ASP.NET
project. Any code you write in the library will be accessible to yuor UI
code.

Try to keep ALL of your business logic in the library and limit the code in
the UI project to just controls and code SPECIFIC to the UI for that
application. Of course, there are seven (or more) possible layers you can
develop, but I'm guessing you'll only need two for your app.

My .02

Michael Earls
 
Is it possible to have a .cs file that references classes created in .vb
all
within the same project[web app]?
I would like to start using cSharp, but the rest of the project is in vb and
the 2 cant seem to coexist.

It should work on a page by page basis. Visual Studio will probably not
support it though but you can write one page in VB and the next in C#.

If you mean by "reference classes" a C# page calling logic that was
originally written in VB, you can do so as long as you compile the VB part
first and then import it into your C# code file. It would then go through IL
though, the C# part never sees the VB code.

Why not rewrite your entire project to C#? That would get you started, you
will learn al the differences and equivalents and you could do it from
Visual Studio.
 
Back
Top