|
-
Oct 10th, 2000, 11:02 AM
#1
Thread Starter
New Member
Hi All
I am trying to allow for multiple selection of files in a listview. I have an array which holds the FileID of the file that has been selected but I also need it to be able to hold the File name and version number. I'm not even sure if I should be using a dynamic array. If anyone can help I would be very greatful.
Thanks
-
Oct 10th, 2000, 11:38 AM
#2
New Member
One solution would be to to use a private Type
Type MYTEST
FileID As Long
FileName as String
VersionNumber As String (best if you're gonna have minor values)
End Type
Use them in your array.
-
Oct 10th, 2000, 11:43 AM
#3
Instead of an array of just the File ID, I believe what you want to do is to create an array of a user-defined type (UDT) (a UDT is just a data structure consisting of two or more variables). You could set it up like this (has to be at the module level):
Code:
Option Explicit
'...
Private Type FileData
FileID As String 'using String here, can be any data type
FileName As String
VersionNbr As String
End Type
'declare a dynamic array of this new Type:
Private arrFileData() As FileData
'...
' here's what you would put in your routine to load the
' array based on what was selected in the listview:
Private Sub LoadArray()
Dim intX As Integer
Dim intY As Integer
intY = 0
Erase arrFileData
For intX = 1 To ListView1.ListItems.Count
If ListView1.ListItems(intX).Selected Then
intY = intY + 1
Redim Preserve arrFileData(1 To intY)
arrFileData(intY).FileID = ListView1.ListItems(intX).Text
arrFileData(intY).FileName = ListView1.ListItems(intX).SubItems(1)
arrFileData(intY).VersionNbr = ListView1.ListItems(intX).SubItems(2)
End If
Next
End Sub
I hope this is what you were after.
"It's cold gin time again ..."
Check out my website here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|