Dennis,
Note that although the MyBase keyword is used to reference the base class,
the instance being used is the current instance of the class - meaning the
derived class instance.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vakeymybase.asp
MyBase does not refer to an instance of the base class - it refers to the
derived class instance but in the context of the base class so that you can
access the base class methods/properties/etc (only protected, friend and
public). So if you need a reference to an instance of the base class, you'll
have to create one yourself. Since you know the class you're deriving from
at compile time itself, you can create an instance directly just as you
would for any other type at compile time and then invoke the private method
using Reflection:
Dim baseobject As New mybaseclass
baseobject.GetType.InvokeMember("privatesub", _
Reflection.BindingFlags.Instance Or _
Reflection.BindingFlags.NonPublic Or _
Reflection.BindingFlags.InvokeMethod, _
Nothing, baseobject, New Object() {})
However, you would have to consider the state of the object when trying to
invoke the private method of the base class. The executing of the private
method within the base class object would be occurring when the object has
reached a particular state. This wouldn't be the case for you when you just
create the instance and invoke the private method directly. The base class
object might not be in the right state and the execution of the private
method might not give you the right results or results that you are
expecting. But if you know that this isn't going to be an issue, then you
should be fine. Just wanted to point out the repercussions of directly
invoking a private method.
hope that helps...
Imran.