Get around 64k limit in Visual Basic 6

The easiest way is to define your data as Variant. Here's an example:

Option Explicit

Private Sub Command1_Click()
   Dim one_offsets(6399) As Single
   one_offsets(0) = 33
   one_offsets(1) = 44

   Dim d As Data
   Set d = New Data
   d.one_offsets = one_offsets
End Sub

and then in your Data class:

Option Explicit

Private m_1_offsets As Variant
Private m_2_offsets As Variant
Private m_init_d_offsets As Variant
Private m_init_a_offsets As Variant
Private m_e_offsets As Variant
Private m_d_offsets As Variant
Private m_a_offsets As Variant
Private m_final_e_offsets As Variant

Public Property Get one_offsets() As Variant
   one_offsets = m_1_offsets
End Property

Public Property Let one_offsets(ByVal Value As Variant)
   m_1_offsets = Value
End Property

If you then inspect m_1_offsets in the Watch window, you will see it is defined as Variant/Single(0 to 6399).


I haven't tested that this works yet, but I've made a class like this:

Public 1_offsets As Variant

Private Sub Class_Initialize()
    ReDim 1_offsets(0 To 6399)
End Sub

And everything compiled

Got this from here: Creating VB array that is public, within class module

Tags:

Vb6