-
I'm not sure how to explain with words, so let me put the code down and maybe someone out there can explain why it doesn't work.
'from class1
Private WithEvents txt As TextBox
Public Property Set TextBoxCtl(OutsideTextBox As TextBox)
Set txt = OutsideTextBox
End Property
'in the main form
Private textcontrol as class1
Set textcontrol = new class1
Set textcontrol.TextBoxCtl = Text1(0)
'Text1(0) being part of a control array
When I run I get the error "Object or class does not support that set of events"
I'm rather new at this and completely baffled.
-
I'm not sure, but it could be the array of Text1 raises events with a index argument, and you don't have those in your class1. Have you tested with a textbox that is not in an array?
-
It works fine for single text boxes. How could I change the TextBoxCtl property to an array of controls? I've tried a few things, (changing the argument "outsidetextbox" to an array, changing the storage var "txt" to an array, adding and Index param to the txt_Change and txt_KeyPress events) but they all raise errors.
-
I guess there is no way out, just if you didn't make the control an array, and instead make a reference array with all the textboxes references inside