Arrays of structures

  • Thread starter Thread starter OpticTygre
  • Start date Start date
O

OpticTygre

If I have a structure...

Public Structure UploadFile
Public FullPath As String
Public FileName As String
Public FileSize As String
Public FileType As String
Public DateModified As String
Public FileExtension As String
End Structure

And I wanted to store multiple "uploadFile" variables into an array, what
would be the proper syntax for that?

Ie: Dim UploadFileArray() as UploadFile

Don't you have to declare another variable as a 'new uploadfile' first?
Just confused over the proper syntax. Thanks for any help.
 
OpticTygre said:
If I have a structure...

Public Structure UploadFile
Public FullPath As String
Public FileName As String
Public FileSize As String
Public FileType As String
Public DateModified As String
Public FileExtension As String
End Structure

And I wanted to store multiple "uploadFile" variables into an array, what
would be the proper syntax for that?

Ie: Dim UploadFileArray() as UploadFile

Don't you have to declare another variable as a 'new uploadfile' first?
Just confused over the proper syntax. Thanks for any help.
To use it you just: need to remember to Redim Preserve the array
To assign values
UploadFileArray(1).FullPath = "c:/your Path"
UploadFileArray(1).FileName = "yaddayadda.txt"
etc
 
The NEW method is not used when declaring Structures unless you have a NEW
sub as one of your structure elements.
 
Back
Top