problem instantiating inherited forms (easy one for the experts!)

K

K. Shier

VB.Net 2002:

i have two data-entry forms derived from an inheritable class,
'frmDataEntry'.

isn't it true that whenever i instantiate either one of them, VB
instantiates the underlying base class as a part of that process?

if so, that is probably a 'clue' to why things aren't working right, but i
still don't know the exact cause of the problem...

when i attempt to open both forms simultaneously in my app, whichever one i
open _second_ doesn't initialize properly, as though it is based on the same
base class instance as the first. (the reason i think so is: the base
class contains some run-once code that should execute whenever any
data-entry form is opened. it runs for the first form i open, but not for
the second.)

is this scenario setting off any mental 'warning flags' yet? what am i
doing wrong here?

fyi: the base class is declared public; the derived classes are declared
public; the flag controlling the run-once code is declared 'Protected' in
the base class (but a declaration of 'Private' yields the same results);
when i instantiate the forms, each has its own object variable (i.e. i am
not re-using a form variable); the only thing they have in common is they
share the same MDIParent...; i am showing them using the '.show' method...
can't think of anything else relevant, really...

help plz?! =)

as always, any insight would be much appreciated! THANKS in advance! =)
 
K

K. Shier

ok maybe it's not so easy...

a bit more experimentation has shown that everything works as expected when
i *do not* open the forms as MDIChildren.

however, when i open them as MDIChildren, the second (and subsequent) forms
opened *do not* fire the Form_Activated event of the base class.

is this by design? if so, how are you supposed to use an inherited form's
Activated event in an MDI context?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top