I am trying to compile a VB6 application, but with the error "Runtime Error 91": "Object variable or with a block variable not set." It turns out that the Resize event of the user control is fired during compilation and invocation of code that tries to access an object that has not yet been created.
Why does an event occur during compilation, and is there a way to stop it?
Change . I had the code here, but this is not relevant. The problem arises because UserControl code (namely, Initialize, ReadProperties, Resize, and WriteProperties events) can run at unexpected times. If the code in these events relies on another code to initialize any of its data structures, there is a good chance that it will fail because this initialization code may not be executed. Especially during compilation when nothing should be done! I would call this a mistake, but I'm sure Microsoft can somehow rationalize it.
raven source
share