Fixed String and Fixed Array 
Author Message
 Fixed String and Fixed Array

I am having trouble converting this VB6 Type into a VB.Net Structure.
It's made hard by having fixed strings and fixed arrays. I continue to get
bad record lenth errors. This is despite the fact that the length of a file
with one record in it is exactly the same length as the VB.Net structure.

Any help would be greatly appreciated...

Public Type STANK8DATA
    Number(CLARTANKS) As String * 3
    TpMin(CLARTANKS) As Single
    TpMax(CLARTANKS) As Single
    Process(CLARTANKS) As String * 25
End Type

Public Structure STANK8DATA
    <VBFixedString(3), VBFixedArray(CLARTANKS)> Dim Number() As String
    <VBFixedArray(CLARTANKS)> Dim TpMin() As Single
    <VBFixedArray(CLARTANKS)> Dim TpMax() As Single
    <VBFixedString(25), VBFixedArray(CLARTANKS)> Dim Process() As String
End Structure

Derrick



Wed, 25 Aug 2004 01:55:26 GMT  
 Fixed String and Fixed Array
Are the characters in the file Unicode or ASCII?  VB6
would read characters as ASCII and convert them to Unicode
automatically.  You may be reading two bytes at a time
rather than one.

Also, I don't know how to interpret the attributes but an
array declaration of 3 allocates 4 elements.

Keith

Quote:
>-----Original Message-----
>I am having trouble converting this VB6 Type into a
VB.Net Structure.
>It's made hard by having fixed strings and fixed arrays.
I continue to get
>bad record lenth errors. This is despite the fact that

the length of a file
Quote:
>with one record in it is exactly the same length as the
VB.Net structure.

>Any help would be greatly appreciated...

>Public Type STANK8DATA
>    Number(CLARTANKS) As String * 3
>    TpMin(CLARTANKS) As Single
>    TpMax(CLARTANKS) As Single
>    Process(CLARTANKS) As String * 25
>End Type

>Public Structure STANK8DATA
>    <VBFixedString(3), VBFixedArray(CLARTANKS)> Dim Number
() As String
>    <VBFixedArray(CLARTANKS)> Dim TpMin() As Single
>    <VBFixedArray(CLARTANKS)> Dim TpMax() As Single
>    <VBFixedString(25), VBFixedArray(CLARTANKS)> Dim
Process() As String
>End Structure

>Derrick

>.



Wed, 25 Aug 2004 13:14:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Array of Fixed Length Strings...

2. Passing an array of fixed length strings.

3. Passing arrays of fixed length strings.

4. Using fixed-length strings/byte arrays

5. Fixed length strings in a dynamically allocated array

6. Fixed Length String Arrays w/a variable

7. Passing Array of UDT Fixed-Length Strings

8. Huge array and fixed sized strings

9. Copy Memory and Fixed Length String Array!

10. OK -- fixed the big problem -- how to fix little one

11. *** FIX *** Cannot find KeycodeV2.dll, or invalid *** FIX ***

12. Passing fixed length string to API and is returning nulls in string

 

 
Powered by phpBB® Forum Software