Question

Hi I want to convert the code at Webcam using DirectShow.NET to C#. It works perfectly in vb.net. I tried converting using an online converter, however I got about 30 errors,

Any suggestions to what I must do next:

This is the converter that I used :

1) Convert VB.NET to C#

Was it helpful?

Solution

The CodeProject article says the author originally converted this sample from C# to VB.NET. This may be the original C# source:

http://blogs.msdn.com/b/markhsch/archive/2007/11/19/c-webcam-user-control-source.aspx

OTHER TIPS

Who says you even have to convert it? You could throw it in a Class Library and use the DLL in your C# project. No need for translating perfectly working .Net code into other .Net code.

Without the errors and relavent source code, we can't really help. The best bet is to use an online converter (as you did) and fix compiler errors, then test for other errors.

I've used sharpdevelop to translate between vb and c# a few times for projects. It's really pretty great, only had to make minor changes.

http://www.sharpdevelop.net

Use RedGate's reflector against the compiled assembly and the Denis Bauer's disassembler to get back code in the language of your choice.

I'd echo the npinti's suggestion; but I've never found a converter that will do everything flawlessly.

My guess is that you'll find several that do a good/great job; but you're still going to have to do a little work to get everything to play nice.

Learn C#, then convert it.

Maybe C-Sharpener For VB will work

Here is your golden ticket!!! ;) When i found this tool (which does a perfect conversion 99% of the time, it really make s a VB developers life easier and opens up all the online snippets and samples exclusively in C now available for a VB'er... Which BTW- is so overlooked on it's strengths at this point, it's just, well, crazy! ;)

Here is that 'gem' i am referring to: http://converter.telerik.com/

Hope that helps!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top