borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (JPG to AVI)Next Topic (How to Use Keypress Event ?) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : problems instantiating inherited forms
Poster Message
KShier
Level: Guest


icon problems instantiating inherited forms

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...

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

29-09-2003 at 08:28 PM
| Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: problems instantiating inherited forms

VB6 Class_Initialize method is replaces with New() subroutine in VB.NET. So, in order to get access to inherited (basic) class (it's constructor), you need to have this:

sub New()
    MyBase.New()
end sub

This might solve your problem.

____________________________
If you find the answer helpful, please mark this topic as solved.

01-10-2003 at 11:21 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : problems instantiating inherited forms
Previous Topic (JPG to AVI)Next Topic (How to Use Keypress Event ?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder