Results 1 to 40 of 52

Thread: [RESOLVED] How can we hold an array has 20 MILLION PARAMETERS in VB?

Threaded View

  1. #17
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: How can we hold an array has 20 MILLION PARAMETERS in VB?

    I'm trying to do a COPYMEMORY on an ARRAY of Doubles

    Code:
    Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
    
    Private Sub Form_Load()
    
    Dim i As Integer, strHold As String, cmLen As Long
    
    Dim WorkArray(100) As Double
    Dim TestArray(100) As Double
    Dim TestString As String * 8000
    
    For i = 0 To 100
        WorkArray(i) = CDbl(i) * 100
    Next i
    
    Debug.Print "WorkArray looks like "; WorkArray(0); WorkArray(1); WorkArray(100)
    
    cmLen = 8 * 2  ' If I make this 8 * 100 it blows up
    
    CopyMemory TestString, WorkArray(0), cmLen
    
    CopyMemory TestArray(0), TestString, cmLen
    
    Debug.Print "TestArray looks like "; TestArray(0); TestArray(1); TestArray(100)
    
    Stop
    
    End Sub
    produces this in the immediate window

    Code:
    WorkArray looks like  0  100  10000 
    TestArray looks like  0  100  0
    So I've proven I can move an array to a string and back to a different array.

    But if I change cmLen to 8000 it blows up - the IDE actually crashes.

    Why is that??
    Last edited by szlamany; Dec 27th, 2007 at 10:14 AM.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width