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

VB.net programming of an Addin - how to correctly refer to application object

I'm programming an add-in DLL that is loaded via an add-in file, a ribbon file and the DLL.

For example, to open an image, I used the following code (vb.net) in my panel:

_application as McApplication = McApplication.ThisApplication

This worked in IP 10 with DevComponents.DotNetBar2 vers., but no longer works in IP 11 with DevComponents.DotNeetBar2 vers.

Error in Image-Pro: Exception has been thrown by the target of an invocation.

And another error is thrown that I couldn't find, namely
Error in Image-Pro: Control initialize failed. Object reference not set to an instance of an object

I wonder what changed but I'm also sure I wasn't doing it right before. So please, whoever is familiar with this type of programming, please help me by providing me with some sample code that accomplishes the task of opening an image based on the known image file name and/or applying a threshold to an image...

Very grateful.
Regards, Helga

Best Answer

  • Options
    Answer ✓
    Well, I solved the problem. It was related to licensing. In IP 11, Basic does not have the same scope as in IP 10. So my add-in needs the Basic package in IP 10, but the 2D Analysis Package in IP 11. That's all.

    By the way, I was aware of the version difference of DotNetBar. I would not have been able to compile the DLL if I had not pointed to the correct DotNetBar DLL.

    @Yuri, @NikitaRG Thanks for the answer anyway.

    Regards, Helga


  • Options
    edited June 27
    Hi Helga,

    The version of DevComponents.DotNetBar2.dll was updated in IP11 to and if your addin has reference to a fixed version of DotNetBar2 it could cause problems. 

    Can you recompile the addin with the reference to the new version of 

  • Options
    Hi Helga,

    IP10 is using DotNetBar version and IP11 is using DotNetBar version
    Please, try to recompile your Add-In with DotNetBar version to use in IP11.

Sign In or Register to comment.