Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2003

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
K. Shier - 29 Sep 2003 15:44 GMT
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. Shier - 30 Sep 2003 21:16 GMT
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?

> VB.Net 2002:
>
[quoted text clipped - 28 lines]
>
> as always, any insight would be much appreciated!  THANKS in advance! =)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.