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 2004

Tip: Looking for answers? Try searching our database.

Windowsforms inheritance: driving me nuts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KennethBohman - 18 Sep 2004 21:37 GMT
Question: how to stop functions from executing twice when using inherited
Windows Forms?

Background:
WindowsForm + forms inheriting from this (base)form.
VB.NET 1.0

Description:
In the BaseForm I've got a procedure which I override in each of the
inherited forms. The procedure controls accessibility of the controls
inherited forms

What happens is that the overriding procedure is called and executed twice.
Why that is I don't seem to work out, nor how to get around it. There is
probably a very clever thought behind this, but I would rather settle with
one execution. Note, that  no eventhandlers are defined.

Obviously I can't define the base form as mustinherit, meaning that I must
define the function as overridable with an empty body. I'm sure there is an
easy solution to that, but I don't seem to find any such examples.

Signature

Thankful for any help,

Kenneth Bohman

KennethBohman - 19 Sep 2004 14:17 GMT
I solved the problem. Created a new function for testing purposes. The
signature being exactly the same as for the repeating one. The new one only
fires once, so I just moved the code from the first to the other. I don't
inted to investigate the reasons behind, but I'll keep this experience for
the record.

> Question: how to stop functions from executing twice when using inherited
> Windows Forms?
[quoted text clipped - 16 lines]
> define the function as overridable with an empty body. I'm sure there is an
> easy solution to that, but I don't seem to find any such examples.
Joey Callisay - 20 Sep 2004 06:43 GMT
I don't seem to understand why the function is called twice not unless the
base form form and the inherited form has the same methods and the inherited
form method calls the base's before its own. (e.g. base.MethodName()).
About the base form not being mustinherit (abstract) refer to this link:
http://www.urbanpotato.net/Default.aspx/document/970

> I solved the problem. Created a new function for testing purposes. The
> signature being exactly the same as for the repeating one. The new one only
[quoted text clipped - 22 lines]
> > define the function as overridable with an empty body. I'm sure there is an
> > easy solution to that, but I don't seem to find any such examples.

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.