Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21096

Referencing control arrays from collections

$
0
0
I am trying to use a collection to reference a control array. In the example below

Col(1).Top = DrawTop

would replace

F.MBIcon(ControlIndex).Top = DrawTop

It doesn't work. It sets the property on the wrong object, not at all or accesses a control array index that doesn't exist.

Is what I am trying to do possible? It would make my code more readable. Note that I would replace Col(1).Top with
something like FMB(Index(SubItemType)).Top in my final code.

I am aware of CallByName and that would help too in some parts of my code.

Cheers, Brent

Function MenuDrawSubItems(Area As String, Level As String, DrawLeft As Long, DrawTop As Long, ItemIndex As Long)
Dim col As New Collection

For s = 1 To MB.Item(ItemIndex).SubItemsCount
SubItemsType = MB.Item(ItemIndex).FSubItemsType(s)
ControlIndex = MB.Item(ItemIndex).FSubItemsIndex(s)
col.Add F.MBIcon(ControlIndex)
col.Add F.MBLabel(ControlIndex)
Select Case SubItemsType
Case "Icon"
col(1).Top = DrawTop
[more code]
End Function

Viewing all articles
Browse latest Browse all 21096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>