1

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#

2
  • 1
    30 errors for a code converter isn't bad, actually. Are they particularly bad errors, or does the code just need a little massaging to work properly? Generally, the "best way" to convert from one language to another is going to involve some manual work. This is for the same reason that machine translations of spoken/written language tends to be not-so-perfect. It's just that compilers are stricter than humans in interpreting the result. Commented Jun 24, 2010 at 17:27
  • not bad errors i think will work on it lil hard coz its dshownet Commented Jun 24, 2010 at 17:32

9 Answers 9

7

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

Link

Sign up to request clarification or add additional context in comments.

Comments

5

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.

Comments

3

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.

Comments

2

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

Comments

2

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

1 Comment

Since answering this question 2 years ago, I have since moved on from relfector to ILSpy and haven't looked back. wiki.sharpdevelop.net/ILSpy.ashx
1

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.

Comments

1

Learn C#, then convert it.

Comments

0

Maybe C-Sharpener For VB will work

Comments

0

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!!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.