![]() |
Click here to advertise with us
|
|
|||||||
| VB.NET General Discussion VB.NET general discussion area |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi There,
I've been trying to convert the below VBA code to VB.NET: Code:
Option Compare Database
Declare Sub Process Lib "Process.dll" (ByRef sInt As Integer, ByRef sString As MemInfo)
Type MemInfo
sString As String * 100
End Type
Public Sub test()
Dim sSize As Integer
Dim sWord As MemInfo
sSize = 100
sWord.sString = "Hello: "
Call Process (sSize , sWord )
MsgBox sWord.sString
End Sub
Last edited by JuggaloBrotha; 12-09-2008 at 8:34 AM. Reason: Set to resolved based on last OP post |
|
|||
|
hey mate.. i'm having this error while running in .NET:
Quote:
any thoughts? |
|
||||
|
What line is it erroring on and what's the exact error message? (Posting a screenshot of the error message should be good enough)
__________________
Currently using: VS 2005 & 2008 Pro w/sp1 on Win7 Ultimate x64. ![]() There are 3 kinds of people in the world: Those who can count and those who can't. 4 out of 3 people have trouble with fractions. Windows has a 64 bit GUI for a set of 32 bit extensions on a 16 bit shell for an 8 bit OS using a 4 bit kernel made by a 2 bit company that can't stand 1 bit of competition. |
|
|||
|
Visual Studio 2005 converted it to this:
Code:
Declare Sub Process Lib "Process.dll" (ByRef sInt As Short, ByRef sString As MemInfo) Structure MemInfo <VBFixedString(100), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=100)> Public sString() As Char End Structure Public Sub test() Dim sSize As Short Dim sWord As MemInfo sSize = 100 sWord.sString = "Hello: " Call Process(sSize, sWord) MsgBox(sWord.sString) End Sub |
|
|||
|
Hey mate the following error has occurred.
P.S: the VBA code is working correctly. I just don't understand why the memory allocation is different between VBA and .NET! any further thoughts? thanks |
|
|||
|
hey mate.. i got it working...
changed the following code: Code:
Structure Meminfo
<VBFixedString(100), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=100)> Dim sCobol As String
End Structure
Code:
Structure Meminfo
<VBFixedString(100), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=100)> Dim sCobol As String
End Structure
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|