Need help to convert the following c# code to vb

V

Vikas Kumar

Hi, I'm not able to convert the following dll import statement in C# to
VB.NET. Can any one please help me in this respect?

[DllImport("iphlpapi.dll", ExactSpelling = true)]
 
J

Jeffrey Tan[MSFT]

Hi Vikas,

Below is the translated code per your request:

<DllImport("iphlpapi.dll", ExactSpelling := True)> _

Normally, you may use the following C# to VB.net converter to get the 90%
work done:
http://authors.aspalliance.com/aldotnet/examples/translate.aspx

Note: this converter is not perfect, you should correct some syntax
manually.

Another way is using Reflector(a must have tool for .Net developer) to open
your assembly and switch the view language from C# to VB.net. This will
almost always give you a perfect translation.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Be aware that while Reflector will give you code with virtually no
adjustments required to compile, it has no way to provide local variable
names or comments - this makes the result of limited value since it's
partially obfuscated.

You are better off using a source code converter.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
 
J

Jeffrey Tan[MSFT]

Hi David,

Yes, I agree that Reflector will not provide comment. However, if the code
is not obfuscated, it will provide the local variable names without any
problem, this conclusion is based on my test result.

Since Vikas did not mention any obfuscated code in his post, I assume
Reflector is a very convinient choice for him, if he wanted to translate
all the code in the assembly/project. Also, since Vikas has the source
code, it is not hard for him to obtain a not-obfuscated version of project
assembly, so I assume Reflector is a good choice in this situation. :)

Anyway, thank you for pointint out the obfuscation issue of Reflector.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Vikas,

Have you reviewed our replies? Is your problem resolved? Please feel free
to tell me, thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top