Home Image-Pro Automation (Macros, Apps, Reports)

Unclear error

Hi Guys,
I wrote successfully an App some months ago.
Today I just added few things to the App but, after writting the new functions, the following error is came up.



Error message reports : "Format" is ambiguos and it is imported from namespace ......
this error is shown only when the option "Compiled" is set to On


The original APP was running is Compiled mode on since the beginning without problem.
To implement the new function only the Mediacy.Addins.Datacollector.dll references has been added to the project.
Here the Imports and part of the references used by the App


Any suggestion is welcome.
Grazie
Maurizio

Answers

  • Hi Maurizio,

    There are different Format functions in different namespaces, for example Microsoft.VisualBasic.Strings.Format. There is also "Format" function that is used in Interpreted mode (internal macro scripting language), this function is not accessible in Compiled mode. Compiled mode uses only functions provided by referenced DLLs (.NET framework or other).

    In compiled mode you can add a reference to 
    Microsoft.VisualBasic and use Format as it is (you can add "Imports Microsoft.VisualBasic.Strings" or use full class namespace Microsoft.VisualBasic.Strings.Format) or switch to other Format functions from .NET, such as String.Format.

    Regards,

    Yuri
  • Hi Yuri,
    many thanks.
    but still I didn't understand why the problem came up only now.
    before making the last modifications I didn't find any problem working in Compiled mode.
    This kind of Premier behavoir make me confused
    Ciao
    Maurizio

  • Hi Yuri,
    Just for your info.

    I tried to add the " Imports Microsoft.VisualBasic.Strings" in the project



    getting back the following error. It seems that the namespace is still in the projet.
    I removed the Imports from the projec.



    The second solution suggested by you (use the  
    full class namespace Microsoft.VisualBasic.Strings.Format) is working fine

    Grazie 
    Maurizio
  • Hi Maurizio,

    It can mean that you already had all necessary references and imports and the problem with "Format" was a namespace conflict. As you have many Imports in your file, one of the classes may also have "Format" function  (one new namespace or import could be added recently). Using full class specification should fix this problem.

    Yuri
Sign In or Register to comment.