What was MS thinking

  • Thread starter Thread starter Pete Davis
  • Start date Start date
P

Pete Davis

Okay, someone tell me I'm making a mistake here:

I need to create my own CurrencyManager class derived from
BindingManagerBase.

As far as I can tell this is impossible to do. The MSDN docs say,
erroneously:

---

Notes to Inheritors: When you inherit from BindingManagerBase, you must
override the following members: AddNew, Count, CancelCurrentEdit, Current,
EndCurrentEdit, GetItemProperties, OnCurrentChanged, Position, RemoveAt,
ResumeBinding, SuspendBinding, and UpdateIsBinding.

---

The problem is there are, I believe, 5 members of BindingManagerBase that
are marked as "internal abstract", despite the fact that the class itself is
marked a public abstract.

As far as I can tell, there's no way to override an internal abstract member
from a class in System.Windows.Forms.

Of course, if I don't override the methods, I get a "myclassname does not
implement inherited abstract member 'membername'"

But if I try to override them, I get: "no suitable method found to override"

WTH? I mean, the documentation makes it sound like you can derive from the
class, but at this point, all evidence is to the contrary.

Any ideas?

Pete
 
They are actually marked 'protected internal abstract', which means you
should be able to override them. The following worked for me:

class test : System.Windows.Forms.BindingManagerBase
{
protected override string GetListName(ArrayList list)
{
return null;
}
}
 
What? You actually compiled that? I find that hard to believe. There are
about 20 abstract methods in BindingManagerBase. It won't compile if you
don't implement them.

And yes, string GetListName(ArrayList list) is protected internal abstract ,
but string GetListName() [with no parameters) is simply internal abstract.

Pete
 
By the way, the methods and properties that are internal abstract an NOT
protected internal abstract are:

BindType.get
DataSource.get
GetListName()
IsBinding.get
SetDataSource(object)

Pete
 
You are right Pete, my bad. Didn't notice that there is another
GetListName to be imlplemented. Well, I guess the fellow programmer
forgot to type 'protected' for those two methods and three properties.
 
Pete, I think MS owes you an icecream, or a MSDN subscription... or both =)

- Michael S
 
Thanks guys. Really, I was kind of hoping someone was going to embarrass me
by saying, "No, all you have to do is XYZ." In fact, for a second, I thought
the other guy had me.

Alas, I'm going to have to write my own BindingManagerBase (or include the
functionality in my CurrencyManager) as well which is a big annoyance since
I already have to write CurrencyManager and RelatedCurrencyManager classes.

I know I can call internal or private methods using reflection. I was kind
of hoping someone might have some way of tricking the compiler into letting
me override internal abstract methods, but I figured that was a real long
shot.

Oh well. Thanks for the responses guys, even though the only solution is to
beat up some .NET framework developers. ;-)

Pete
 
Hi,

Commiserations, and you might want to consider filing it as a bug report so
others more fortunate than yourself can be spared the torment either in .NET
2.0 or maybe even as part of a framework service pack.

Steve
 
Steve McLellan said:
Hi,

Commiserations, and you might want to consider filing it as a bug report
so others more fortunate than yourself can be spared the torment either in
.NET 2.0 or maybe even as part of a framework service pack.

This is the sad part with .NET.

In Delphi you get all the code for the whole VCL (i.e FCL) and a bug like
this could have been fixed by yourself in no-time flat.There is still the
hazzle of bug-reporting, but you could fix it and move on. It's no fun
telling your project lead or customer that the project is in a dead end
because of a bug in a core library. - Sorry, but if you have the cash, you
could always buy Microsoft and have the bug fixed quicker.. =)

However, there are plenty of Microsoft employees that scans this group and
maybe they'll report the bug.If Microsoft was smart, they should hire Jon
Skeet for a fair amount of money and have him make bug reports, he reads
just about everything in this newsgroup!

And I still think Microsoft owes Pete an icecream... =)

- Michael S
 
Back
Top