Home All Groups Group Topic Archive Search About

Is the difference intended?

Author
5 Sep 2006 9:39 AM
doker0
Hi.
Recently, when I was designing myown buttonbar and a designer
serialization(typeconverter) for its button collection I've slipped on
construction like this:

If TypeOf value Is Field Then

It occured that sometimes it is not even if in Else i msgboxed it
(value.ToString) and it said ButtonBarControl.Field.

So i changed it to something like this:
If Type.Equals(value.GetType, GetType(Field)) Then
and this one above works perfectly.

I wonder what's the difference and is it indeed intened.

Best regards,
Doker

Author
5 Sep 2006 9:47 AM
doker0
After further inquiery i see that the same happens with both lines.
Why and when an object X of type A isnot of type A?
Author
5 Sep 2006 10:02 AM
Patrice
AFAIK TypeOf also takes inheritance into account (that is if B inherits from
A Then TypeOf BVar Is A is true).

Could it be your problem ? Simple repro ?

--
Patrice

<dok***@wp.pl> a écrit dans le message de news:
1157449653.079366.38***@i3g2000cwc.googlegroups.com...
Show quoteHide quote
> After further inquiery i see that the same happens with both lines.
> Why and when an object X of type A isnot of type A?
>