Is the difference intended?

  • Thread starter Thread starter doker0
  • Start date Start date
D

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
 
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?
 
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 ?
 
Back
Top