Message 1 of 6
Passing array data
Not applicable
05-17-2000
02:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Could someone give me a hand passing array data from one function to
another similiar to this?
Type LayerData
Name As String
Color As String
Linetype As String
End Type
' ----- Read data file
Function Function_1 (strFName As String)
Dim i As Integer
Dim lyrData As LayerData
Open strFName For Input As #1
' Loop until end of file
i = 0
ReDim lyrData(i)
On Error Resume Next
Do While Not EOF(1)
' Read data
ReDim Preserve lyrData(i)
Input #1, lyrData(i).Name, lyrData(i).Color, lyrData(i).Linetype
i = i + 1
Loop
' Close file
Close #1
' Here I would like to pass LyrData to Function_2
Function_2 lyrData
End Function
' ----- Function to receive array data
Function Function_2 (aryData)
Dim i As Integer
' do something with the array data...
For i = 0 To UBound(aryData)
Debug.Print aryData(i).Name
Next
End Function
another similiar to this?
Type LayerData
Name As String
Color As String
Linetype As String
End Type
' ----- Read data file
Function Function_1 (strFName As String)
Dim i As Integer
Dim lyrData As LayerData
Open strFName For Input As #1
' Loop until end of file
i = 0
ReDim lyrData(i)
On Error Resume Next
Do While Not EOF(1)
' Read data
ReDim Preserve lyrData(i)
Input #1, lyrData(i).Name, lyrData(i).Color, lyrData(i).Linetype
i = i + 1
Loop
' Close file
Close #1
' Here I would like to pass LyrData to Function_2
Function_2 lyrData
End Function
' ----- Function to receive array data
Function Function_2 (aryData)
Dim i As Integer
' do something with the array data...
For i = 0 To UBound(aryData)
Debug.Print aryData(i).Name
Next
End Function