UserForm usage
keepITcool wrote:
I'm not sure your code is very efficient: Passing the form byval
creates 2 instances of the interface class (both in the caller and in
the callee).
Worse the unreferenced object created in the caller doesn't get
released until the project ends e.g. press the reset button in the VBE
or re-using the global instance of userform1 :-( Of course, passing
ByRef makes no difference.
Since you're not really using the interface class object, I think
passing a string is more logical.
I guess I'd reluctantly go for the latebound call using Object.
However, I think if the OP's has a genuine need for a generic routine
to show a userform (rather than merely posing an interesting
theoretical question), I would expect them to prefer the classname as
a string in the Userforms.Add method. I can't quite see it - element
names stored in a database, perhaps?
Now, can someone tell me why the Show method isn't in the interface...
Jamie.
--
|