Converting VB structures

B

Brenton Norman

Here is a VB6 structure declaration and an associated variable before conversion from VB6 to VB .Net (2003):

Type CasData
RecType As String * 1
ConsNo As String * 3
DocType As String * 1
DistNo As String * 2
Amount As String * 8
IndexVal As String * 2
PocketNo As String * 1
CutslipNo As String * 2
MachNo As String * 2
Special As String * 1
ModField7 As String * 1
ModField6 As String * 1
ModSerial As String * 1
ModTransit As String * 1
ModAccount As String * 1
ModTransact As String * 1
ModAmount As String * 1
Field7 As String * 8
Field6 As String * 8
SerialNo As String * 8
BankNo As String * 8
AccountNo As String * 8
TransactCode As String * 8
CRC As String * 2
End Type
Dim CasDatRec As CasData

(I was unable to send the converted code because an exception was raised concerning "potentially dangerous" code it contained.)

Here is a VB .Net call to FileGet using this variable:

FileGet(CasFile, CasDatRec, CurrentRecord)

However, FileGet expects the second parameter to be of datatype System.ValueType and, with Option Strict set On, will not accept CasDatRec as declared.

I tried this:

FileGet(CasFile, CType(CasDatRec, RTRPSReformat.Subs.CasData), CurrentRecord)

This was accepted with Option Strict On but would not return any data.

How must I handle the second parameter (CasDatRec) so that it is accepted with Option Strict On and returns the expected data?

Brenton


From http://www.developmentnow.com/g/38_0_0_0_0_0/dotnet-languages-vb.ht

Posted via DevelopmentNow.com Group
http://www.developmentnow.com
 
M

Mudhead

Try using a byte array instead.
Dim casData(79) as Byte

FileGet(CasFile, casData, CurrentRecord)
 

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

Top