Need to convert C# to VB.NET - vb.net

I have some C# source code that I got off the Internet and I want it in VB.NET. How would you convert it because I don't know C#.

I found multiple translators after performing a simple search, but this one looks kind of cool. No installation necessary!... though I have never used it.

Another way is compiling it to, dragging the assembly to Reflector and then decompiling it to VB.NET

If I recall correctly, you can have multiple source languages in the same project. They just have to be in different files. You should be able to call the c# class from a vb.net class without any major problems. This may not be the prettiest option, but it might work for your situation.

You can have a VB project in the same solution as a C# project, and use classes from either from the other, but you can't have both VB and C# source files compiled in the same project.

Related

I made a project in C++ CLI, But I can decompile it using a C# Decompiler

Is there any way, I can prevent my c++ cli project from being decompiled if someone uses a C# decompiler, because I tried to decompile the .exe i made in ILSpy and it showed my whole code, so is there any way I can prevent this?
Thanks
as ancient as this thread is, I ran across it with the same question, and a newish answer. Can't specify the minimum version for this one, but
[module:System::Runtime::CompilerServices::SuppressIldasmAttribute];
on top of each .cpp module did the trick for me:
I didn't investigate much further, yet.
Another useful thing is to add
#pragma unmanaged
to each .cpp that does not contain .net code.
You can
Use a .NET obfuscator.
Or
Only use C++CLI for the boundaries of your app which require to Interact with .NET. And implement your logic in a native C++ library.

Use a C# file in VB.NET

I heard that it's possible to import a c# file and use it's functions in a vb.net application? I have a C# file with a lot of functions, that I want to use, however, I don't want to convert it to vb.net (would take time). Is it possible? Thanks. HOw?
Compile it, and reference the DLL.

compiling VB6 code in .NET environment

Is one able to compile VB 6 code in Visual Studio.NET ? In other words, is it backwards compatible with older VB code?
Since I know there is a difference between managed code (.NET) and unmanaged code, I am wondering if Visual Studio.NET is able to compile unmanaged code as well?
Kind regards,
Kris
While you cannot compile vb6 in the .net Visual Studios, you may use interop libraries to allow vb.6 to utilize managed code
http://msdn.microsoft.com/en-us/library/kew41ycz%28VS.71%29.aspx
No, you can't compile VB6 code in any VS.NET version.
You can open a VB6 .vbp project file in Visual Studio. This automatically invokes the project converter, it will try to translate your VB6 code into VB.NET. The translator does a fairly decent job of it but the VB.NET language has changed pretty drastically. It depends on how 'clean' your VB6 code was.
After the conversion is completed, you'll have to walk through the list of warnings and errors you'll get. Getting none at all is rare. There might be hundreds or thousands. If you're in that boat, it starts making sense to rewrite the code.
Anyhoo, just try and see what hits the fan. You'll have a good idea what you're in for in about ten minutes. Don't forget to copy the project before you start the conversion.
No it is not compatible. I think there is an upgrade wizard, but you will end up fixing some stuff manually.

Location of VB.NET "source" code, similar to Java's JDK src.zip

Does VB.NET have anything similar to Java's JDK source code? When I used to work in Eclipse, I could right click and view the generated code, or "look under-the-hood" so to speak. I found this feature very helpful in understanding what was happening behind the scenes, and it helped me to write better, more simplified code.
I have so far been working with Visual Studio 2010's Object Browser, and I have also been looking at the generated designer files, but these often do not drill down far enough.
The best program to do this is called .NET Reflector and you can download it from here: http://www.red-gate.com/products/reflector/
It lets you see executables and DLL's under the hood
ScottGu has an old blog post about this:
http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx
You can also use the .NET Reflector to peek into the code for any .NET dll, but keep in mind it won't look like the code in Visual Studio :)
http://www.red-gate.com/products/reflector/

Can't add vb class to c# project in vs 2010

When I add my vb classes to my C# project in vs 2008 they are readily available to be used in my c# classes. But for some reason 2010 can't see them. I could be missing something simple but i couldn't make it work in the past hour. Any ideas?
Are you sure you had them included with action compile and not just action content?
CSharp and VB use two differnt MSBuild targets file and I've never heard of mixing them in the same project file. Different project types in the same solution - sure, but not what I think you are saying.
Of course it's a strange world so maybe someone will come by and suprise me with something I never thought possible outside of ILMerge after the build.
you can't mix 2 code languages. like you can add vb and vb, c# and c# but not vb and c# together.
If you do want to mix, use a code converter like c# - vb or something. Here is one to try instead of re coding it all again: Vb.net --> C# converter.
It may not be 100% working but at least you'll convert some code.