Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Convert C# to VB 2005 - Problem using inpout32.dll
 

Convert C# to VB 2005 - Problem using inpout32.dll

Hi friends!

I have this problem to convert this code to VB.net or 2005

using System;
using System.Runtime.InteropServices;

public class PortAccess
{
[DllImport("inpout32.dll", EntryPoint="Out32")]
public static extern void Output(int adress, int value);
}

I try to convert in this:

Imports System
Imports System.Runtime.InteropServices

Public Class PortAccess

<DllImport("inpout32.dll", EnTryPoint = "Out32")> _
Public Shared Sub Output(ByVal adress As Integer, ByVal value As Integer)
End Sub
End Class

But here the error: i can't buil the project
" Name 'EnTryPoint' is not declared. "

Please Help me!

iacido  Sunday, July 02, 2006 4:23 PM
<DllImport("inpout32.dll", EntryPoint := "Out32")>
Ken Tucker  Sunday, July 02, 2006 4:42 PM
By the way, here's a great online tool for converting C# <--> VB.NET: http://carlosag.net/Tools/CodeTranslator/Default.aspx. I use it all the time.
arc_dev  Sunday, July 02, 2006 6:15 PM
<DllImport("inpout32.dll", EntryPoint := "Out32")>
Ken Tucker  Sunday, July 02, 2006 4:42 PM
works perfect!

thanks a lot!




iacido  Sunday, July 02, 2006 5:57 PM
By the way, here's a great online tool for converting C# <--> VB.NET: http://carlosag.net/Tools/CodeTranslator/Default.aspx. I use it all the time.
arc_dev  Sunday, July 02, 2006 6:15 PM
Fantastic!

thanks friend!
iacido  Sunday, July 02, 2006 6:41 PM

Just fyi: you have two options in VB:

1. The .NET DllImport attribute approach(this is the option produced by our Instant VB converter):

e.g.,

<DllImport("inpout32.dll", EntryPoint:="Out32")> _
Public Shared Sub Output(ByVal adress As Integer, ByVal value As Integer)
End Sub

2. The traditional VB6-ish 'Declare' approach - this is the one produced by the carlosag on-line converter.

Both work, butfor conversion purposes the DllImport approach is the most direct equivalent since the attribute is guaranteed toconveythe same informational value as the original C# version.

David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Clear VB: Cleans up VB.NET code
C# Code Metrics: Quick metrics for C#

David Anton  Monday, July 03, 2006 1:02 AM

You can use google to search for other answers

Custom Search

More Threads

• How would I handle and empty result set in a Dataset
• [OTP] Server requirements - May be off topic . . .?
• working with dll's as plugins
• Project developed using Studio VB 2005 on XP 32 bit
• Calling Class files from dialog class
• My.Computer.Network.Downloadfile requires proxy authentication
• saving code generated datagridview to db
• Control similar to openfiledialog, but to select a path/directory only.
• Performance issues using XmlReader
• Windows Service , Regional Date Settings and and Date.Parse