I would like to sort an array of a Containers (ccUser in this case). I have not been able to get the examples I have found to work.
Class cUser
Property controlIndex As Integer
Property id As Text
Property firstName As Text
Property lastName As Text
Property employeeNumber As Integer
Property Tag As Variant
End Class
Private mUsers() As ccUser
[code]Public AddItem(u As cUser) As Integer
Dim c As new ccUser
Dim cTop, cWidth As Integer
ccUser is a ContainerControl which I am embedding within a another ContainerControl. mUsers() is the array of ccUser ContainerControls that are embedded within the ccUserList Container. I use the class cUser to populate the ccUser Container.
Dim lastNames() As Text
For i As Integer = 0 To mUsers.Ubound
lastNames.Append(lastName)
Next
lastNames.SortWith(mUsers)
For i As Integer = 0 To mUsers.Ubound
mUsers(i).Top = 20 + i * 30 // or whatever the gap is between the containers
Next
Note that you are duplicating data: the properties you describe above in ccUser are not necessary:
[code]Public AddItem(u As cUser) As Integer
Dim c As new ccUser
Dim cTop, cWidth As Integer