First of all,
Me
means the reference to the object implicitly passed as a hidden parameter to an instance (non-static) method in order to allow this method to assess the instance. In other words, suppose you have this:
myInstance.MyMethod(someParameter);
This is equivalent to this pseudo-code:
TheClassOfMyInstance.MyMethod(myInstance, someParameter);
This pseudo-code could be used as a real code demonstrating simulation of an instant method by a static version of the method
MyMethod
.
Now, the assignment
me.bmdd = master
is wrong, because
master
is
Object
, but
bmdd
is
BMD
. You cannot assign more specialized instance to less specialized, because
BMD
has more members then
Object
and an attempt to access some of those extra members would cause a fatal error. Fortunately, the system won't let you go that far. If you force this assignment by casting to
BMD
, the cast itself will trow exception in all cases where the instance of
master
is not of the
run-time type
BMD
or derived from this type.
Note that it is important to distinguish
compile-type name and
run-time name.
I agree with Naerling about learning some programming and language.
It's very bad to hard-code any
immediate constants, especially strings; even instead of "" should be
string.Empty
.
Actually, the signature of the constructor
New
makes no sense due to the reason explained above. You could use
Public Sub New(ByRef master As BMD)
. In comments you say that the actual parameter is of the type
Events
. If so, the constructor would never work at all. And if you used the signature
Public Sub New(ByRef master As Events)
it would make no sense.
A couple of notes:
The following names violate very useful Microsoft naming conventions:
Events
(class name can not be plural),
_eventfield
(don't use underscore),
getevents1
(you should use camel case for method names, not numerals).
—SA