Visual Basic 6 Problem

Miscellaneous Forums/General Discussion/Visual Basic 6 Problem

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You don't really need to pass the element as this will be accessible via the array - just pass the index of the record you are interested in:
Private Sub Main()
  With contact_arr(1)
    .text = "text 1"
    .first_name = "First Name 1"
    .last_name = "Last Name 1"
  End With
  Call dostuff(contact_arr(), 1)
End Sub

Private Sub dostuff(ByRef TempArray() As Contact, ByVal Index As Long)
  Dim TempString As String
  
  TempString = TempArray(Index).text
  ' do whatever you want with it here...

End Sub

Or if you prefer you could pass a copy of the record:
Call dostuff(contact_arr(), contact_arr(1).text)

Private Sub dostuff(ByRef TempArray() As Contact, ByVal TempString As string)

  ' do whatever you want with it here...

End Sub

Either way you need to be careful when passing parameters ByRef instead of ByVal. In dynaman's example (and the first parameter in mine) you would not be passing actual values, but pointers to each (since ByRef is the default mode). This could cause you problems when you point to a whole array in one parameter, and an element of the same array in another - particularly if you plan to sort the array within the procedure...