Can someone explain some stuff about TypeConverter's to me?

Winston

Junior Contributor
Joined
Jan 25, 2003
Messages
266
Location
Sydney, Australia
Ok first of all i've read numerous guides on the net but none of them go into specifics, so i'd be happy if someone could explain some stuff..

ok first of all, I know that TypeConverters are used to inform the code generators of the IDE how to create a custom type. And you have to use the TypeConverterAttribute on the custom type passing in the CustomTypeConverter you make.

So far so good? Well that's my understanding so far.

As to the CustomTypeConverter class you make, you have to inherit from TypeConverter obviously, but the thing now i don't get is, which methods do you have to override? What essentially is this class doing? :S... like i've seen methods like for example this:

Public Overloads Overrides Function CanConvertFrom( _
ByVal context As ITypeDescriptorContext, _
ByVal sourceType As Type) As Boolean

If (sourceType.Equals(GetType(String))) Then
Return True
Else
Return MyBase.CanConvertFrom(context, sourceType)
End If

End Function

Like who is calling this function? :S... and like what's happening i'm a little confused.... and why is the else clause invoking the base's version of the function?

Can someone please explain to me the process of how it all works with the code generators doing this, i'm lost.

Thanks heaps.
 
Back
Top