hi! there im new in programming in VB.NET. i want to translate my VB code into VB.NET(VS.NET 2003)..
in my VB project i had this which it works perfectly
- a module called chain.bas
- a test.dll
in my chain.bas i had this
Code:
Global Const ALGO_1 = 0
Global Const ALGO_2 = 1
Global Const ALGO_3 = 3
Global Const DATA_A = 1
Global Const DATA_B = 2
Declare Function Chain_A Lib "test.dll" (ByRef Data As Any, ByRef key As Any, ByVal Single As Integer, ByVal Blocks As Long, ByVal method As Long) As Long
Declare Function Chain_B Lib "test.dll" (ByRef arc As Any, ByRef Data As Any, ByRef key As Any, ByVal Blocks As Long) As Long
Declare Function Chain_C Lib "test.dll" (ByRef arc As Any, ByRef Data As Any, ByRef key As Any, ByVal Blocks As Long) As Long
i had this in commandbutton
Code:
Dim Data(1 To 8) As Byte
Dim key(1 To 8) As Byte
' ** some codes **
Call Chain_A(Data(1), key(1), ALGO_1, 1, DATA_A)
but when it try to convert it in VB.NET
- a class called chain.vb
- a test.dll
Code:
public Class chain
Public Const ALGO_1 = 0
Public Const ALGO_2 = 1
Public Const ALGO_3 = 3
Public Const DATA_A = 1
Public Const DATA_B = 2
Declare Function Chain_A Lib "test.dll" (ByRef Data As Object, ByRef key As Object, ByVal TripleDES As Short, ByVal Blocks As Integer, ByVal method As Integer) As Integer
Declare Function Chain_B Lib "test.dll" (ByRef arc As Object, ByRef Data As Object, ByRef key As Object, ByVal Blocks As Integer) As Integer
Declare Function Chain_C Lib "test.dll" (ByRef arc As Object, ByRef Data As Object, ByRef key As Object, ByVal Blocks As Integer) As Integer
End Class
in my commandbutton ive encuntered an error An unhandled exception of type 'System.DllNotFoundException' occurred in ChainDES.exe
it says that Unable to load DLL (test.dll).
Code:
Dim Data(8) As Byte
Dim key(8) As Byte
' ** some codes **
Call chain.Chain_A(Data(1), key(1), chain.ALGO_1, 1, chain.DATA_A)
kindly help regarding this matter.. im getting stuck in here.. i appreciate you guys fpr helping me..
an error appear
'System.Runtime.InteropServices.InvalidOleVariantTypeException' occurred in Chain.exe Additional information: Specified OLE variant is invalid.
or with this declaration i used the Object since Any keyword is not available anymore in VB.Net
Code:
Declare Function Chain_A Lib "test.dll" (ByRef Data As Object, ByRef key As Object, ByVal TripleDES As Short, ByVal Blocks As Integer, ByVal method As Integer) As Integer
Declare Function Chain_B Lib "test.dll" (ByRef arc As Object, ByRef Data As Object, ByRef key As Object, ByVal Blocks As Integer) As Integer
Declare Function Chain_C Lib "test.dll" (ByRef arc As Object, ByRef Data As Object, ByRef key As Object, ByVal Blocks As Integer) As Integer
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.