Results 1 to 3 of 3

Thread: Is it possible

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2003
    Location
    Florida
    Posts
    18

    Is it possible

    OS NT VB 5.0

    Is it possible to return an Array from a DLL(created with VB) to the Caller VB program. I can pass back variables but not the array ?

    An example of the code will be grate.

    Thanks

    Thanks

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I've never user VB5, but it can't be that different.

    Try returning a Variant, or passing in an uninitialized array to be filled. That's the way I go anyway...
    VB Code:
    1. Private Function FillArray(arrRet() As String) As Boolean
    2.  
    3.     'Redim the array and fill it.  If the fill is successful,
    4.     'return True.  If it is not successful, or an error is
    5.     'raised, return False.
    6.  
    7. End Function
    8.  
    9. Private Sub Form_Load()
    10. Dim arrRet() As String
    11. Dim x As Long
    12.  
    13.     If FillArray(arrRet) Then
    14.         For x = LBound(arrRet) To UBound(arrRet)
    15.             Debug.Print arrRet(x)
    16.         Next
    17.     Else
    18.         MsgBox "Array Not Filled!"
    19.     End If
    20.  
    21. End Sub
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2003
    Location
    Florida
    Posts
    18

    Cool

    Passing the arway as empty works very well.

    Thanks
    Thanks

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