I have created a customised control in a class module, which works in a similar way to a combo box. It consists of a label, onto which I have a command button (or drop button in this case). When this button is clicked, a frame control appears below in a similar fashion to a combo drop down pane. This frame contains various check boxes which a user can check or uncheck as required and then click an OK button, also in the frame. The drop button click event basically sets the visible property of the frame to true or false accordingly.
My problem is, if the form on which my custom control resides has its ShowModal property set to false, the event handler for the drop button does not fire! I have checked this by placing a msgbox inside the event handler. When the form is set to modal, sure enough it fires and the msgbox appears.
Can anyone offer any insight into why this happens and how I can correct it. The form I have designed it for is not a modal form, so as it stands, the control won't work.
Additional info that may assist anyone in diagnosing my probem:
- I have created a class module to handle this custom control, within which I have declared various MSForms control variables, the command button controls being declared WithEvents.
- I have a ParentForm property in my class, which is set to a UserForm already existing in the designer, once my class had been instantiated in a regular code module. Within the class, the controls are then set by adding them to the Controls collection of the ParentForm property (e.g. Set MyFrameVariable = ParentForm.Controls.Add("Forms.Frame.1"). I have set all my controls on the form in this way.
- Events are then handled within the class, by virtue of declaring them WithEvents.
Like I say, the control works perfectly in a modal form, but set it to a non-modal form and the event don't fire!
Please help!
Many thanks!