Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to Initialize some arrays with in a structure, and when the arrays are initialized the memory that they are being allocated to is all off. For example when I set whole(0) equal to something the value is being placed in amount(1) instead of whole(0) very odd. Below is the code I am using to create and initialize the arrays.

    Public Structure fee_inrecord
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim amount() As Double 'Path to data files
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim whole() As Double
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim min() As Double
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim max() As Double
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim exempt() As Double
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim tax() As Double
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim feetype() As Integer
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim base() As Integer
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim round() As Integer
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim blank() As Integer
       <MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)> Dim handling() As Integer

       'UPGRADE_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="B4BFF9E0-8631-45CF-910E-62AB3970F27B"'
       Public Sub Initialize()
           ReDim amount(98)
           ReDim whole(98)
           ReDim min(98)
           ReDim max(98)
           ReDim exempt(98)
           ReDim tax(98)
           ReDim feetype(98)
           ReDim base(98)
           ReDim round(98)
           ReDim blank(98)
           ReDim handling(98)
       End Sub
   End Structure

 

It is like instead of allocating the first slots to amount(0), amount(1), amount(2)...etc it is doing amount(0), whole(0), min(0) so when it calls on the values everything is out of whatck any suggestions?

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...