Hi,

I've built an Active-X control in VB to place an icon in the sytem tray.

The User Control has a form variable (frmParent) which I am setting in the UserControl_Initialize event as follows

UserControl_Initialize
Set frmParent = UserConrol.Parent
End Sub

This works fine when tested. But when I actually place the compiled OCX on a form and try to invoke one of it's methods from the Form_Load event (DropToTray), which uses the frmParent object, I get an error telling me that the object or with block variable is not defined.

Is there some way to initialize the control before the Form_Load event in order to avoid this error. I don't want to have to let the form show until the control is initialized and I don't want to have to call an initialize sub from the form either.

I know I can hide the form and invoke the method a couple of seconds later but as a matter of pride I'd like my control to work as it was intended to (without my having to tweak it from the form).

Any suggestions would be most appreciated.

Best regards,

Rob Brown.