i have one application which is build using VB.NET now
i required to add some C# code inside my existing VB.NET application does it possible or not?
i have one application which is build using VB.NET now
i required to add some C# code inside my existing VB.NET application does it possible or not?
Create a seperate project for the C# code. Then place a reference to C# project into the VB.Net project. You can then access the C# objects as if they were written in VB.Net
You can't add different languages to the same project, but you should be able to add both projects to the same solution, and add a reference from your C# project to VB project or VB project to C# project, and use the types he's created - so long as they're public, of course.
Follow this approach:
1) Create Multi-Project Solutions
2) Add Reference of your CSharp project in your project
Then you can create object of those Class/Forms etc and access methods that you created in CSharp project as:
Dim obj As New YourCSharpProject.SomeClass()
obj.UpdateData()
No. You will need to create a separate project within your solution and place the code in that. If the project is a class library then your original project can reference that and call the library routines. Failing that, there are plenty of online C#<->VB.NET converters available.
Like others said, you cannot directly intermix the two languages because a compiler will only understand the language it is written for. Hence, a VB.NET compiler cannot understand C# code unless MS creates an extension to do so. Something like this comes from my imagination :) -
Dim v as int
%for(int i = 0; i < $v; ++i){}%
Yes, as long as it's a seperate class / page / webcontrol / usercontrol and it's specified as C#. Visual Studio will not like it, and the easy way in VS is to setup a new project within the solution.
If it's just a little C# code, you can first convert it to VB.NET with a converter like http://www.developerfusion.com/tools/convert/csharp-to-vb/, or you can convert it manually.
Otherwise, as already noted, you'll have to put the C# code in another project in the same solution. You can then call the C# code from your VB.NET code in the same solution.