ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using a typeconverter in Excel PIA assembly (https://www.excelbanter.com/excel-programming/418714-using-typeconverter-excel-pia-assembly.html)

GalleySlave

Using a typeconverter in Excel PIA assembly
 
I would like to use a TypeCoverter to regionalise output for enums in an
assembly that is a PIA loaded into Excel.

I can run this and it works on an assembly in a test project I created with
an explicitly referenceed assembly, however when running a project that has
been built as an Excel PIA. If I try:
<System.ComponentModel.TypeConverter(GetType(Resou rceEnumConverter)) _
public enum MyEnum
ItemA
ItemB
end enum

and in code
myE = MyEnum.ItemA
Dim converter As System.ComponentModel.TypeConverter =
TypeDescriptor.GetConverter(myE)

In the immidiate window
? converter.ToString() goves
"System.ComponentModel.EnumConverter"

whereas in my other project (also a strongly signed assembly, but referenced
directly from a newly created stub windows form project), I get

? converter.ToString
"ClassLibrary1.LocalizedEnumConverter"

so it look like the LocalizedEnumConverter is not being bound to the enum -
any ideas? Is this because of the way Excel loads the assembly, and is there
a way arounfd this?


All times are GMT +1. The time now is 03:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com