Winston
Junior Contributor
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.
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.