Windowsforms inheritance: driving me nuts

G

Guest

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

Guest

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

Joey Callisay

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
 

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