
Class object question -- looping through controls
Here's what I got...
I've created a class (clsSmoothForms) that has a label and a section
property. The labels work fine (I use the mouse move, up, and down
events) from the client form. I also would like to use the section
events to loop through the labels in that section, but it keeps giving
me the "object does not support this property or method" error message
when the event I'm using executes. Here's the code I'm using for the
section:
' *** Code Start ***
Private WithEvents mDetail As Section
_______________________________________
Public Property Set Section(ByVal secNewDetail As Section)
Set mDetail = secNewDetail
End Property
_______________________________________
Private Sub mDetail_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Dim lbl As Label ' I only want to mess with the labels
For Each lbl In mDetail ' Error happens here
debug.Print lbl.Name
lbl.Caption = "Changed" & lbl.Caption
Next
End Sub
Then, in the client form that will instantiate the class, I have this
code...
Dim cSEC1 As clsSmoothForms
_______________________________________
Private Sub Form_Load()
Set cSEC1 = New clsSmoothForms
Set cSEC1.Section = Me.Detail
End Sub
_______________________________________
Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
End Sub
_______________________________________
' *** Code End ***
Is it possible to get the names or modify the properties of any or all
the controls that exist in any given section?
Thanks,
Tim