R
Rob
Hello,
I have a routine which builds a form, adding CommandButtons depending on the
entries in some table. I built a class module KWButtonClass which has the
code I list below. It's supposed to run whenever a button on the built form
is pressed, but the Click Event isn't firing. Anyone know why?
(By adding additional code I can verify that the KWButtonClass objects are
in fact being instantiated.)
-------------------------------
KWButtonClass Code:
Public WithEvents KWButton as CommandButton
Private Sub KWButton_Click()
MsgBox ("Clicked!")
End Sub
----------------------
The code for the form I build reads as follows:
Dim ButtonArray() as New KWButtonClass
Private Sub Form_Load()
ReDim ButtonArray(1 to Me.Controls.Count)
For i = 1 to Me.Controls.Count 'the only controls on the form are KWButtons
Set ButtonArray(i).KWButton = Me.Controls(i-1)
Next i
End Sub
I have a routine which builds a form, adding CommandButtons depending on the
entries in some table. I built a class module KWButtonClass which has the
code I list below. It's supposed to run whenever a button on the built form
is pressed, but the Click Event isn't firing. Anyone know why?
(By adding additional code I can verify that the KWButtonClass objects are
in fact being instantiated.)
-------------------------------
KWButtonClass Code:
Public WithEvents KWButton as CommandButton
Private Sub KWButton_Click()
MsgBox ("Clicked!")
End Sub
----------------------
The code for the form I build reads as follows:
Dim ButtonArray() as New KWButtonClass
Private Sub Form_Load()
ReDim ButtonArray(1 to Me.Controls.Count)
For i = 1 to Me.Controls.Count 'the only controls on the form are KWButtons
Set ButtonArray(i).KWButton = Me.Controls(i-1)
Next i
End Sub