Is it possible to have a delegate that points to a Class Method, or even a Shared Class Method? I have the following code and I keep getting told that the methods do not exist. The following code:
Converters( 0, 1 ) = AddressOf ColumnDefinition.NumberToCodeList
Results in a compiler error:
Type "ColumnDefinition" has no member named "NumberToCodeList"
Converters( 0, 1 ) = AddressOf ColumnDefinition.NumberToCodeList
The code is actually inside the class (which is called “ColumnDefinition”). If I try the following:
Converters( 0, 1 ) = AddressOf NumberToCodeList
I’m told “This Item does not exist”. Actually NumberToCodeList is a Method with the correct signature for the delegate. Converters is defined as follows:
Public Shared Property Converters(5,5) As DataConversion
I’d rather have a single set of Delegate functions and a single array of pointers to them. Rather than have to create and instantiate one for every instance of the class (which there could be quite a few of in the application). If I have to I will move them to a module, but logically they belong to the class as it is what defines the types that are being converted.
The delegate is:
Public Sub DataConversion(ColDef as ColumnDefinition, Row as Integer, Assigns Value as Variant)
and the method:
Public Sub NumberToCodeList(ColDef as ColumnDefinition, Row as Integer, Assigns Value as Variant)