Warning XLL function designer

Add-in Express™ Support Service
That's what is more important than anything else

Warning XLL function designer
Warning after XLL UDF function designer use 
Subscribe
Andrei Smolin


Add-in Express team


Posts: 14302
Joined: 2006-05-11
Michael,

Michael Kaden writes:
During the work with Vb.net & VSTO I got many "Not possible" including from MS & MSDN but often found a reliable possibility to reach my goals.


!!! I understand and value this approach a lot! It allows you to reach your goals by better understanding how this or that thing works; it allow us to look at what is done (code and manuals) critically and look for a .

Michael Kaden writes:
In case that I need the ComAddIn, I am searching for a work around to make ComAddIn UDF's hidden.


I suppose we know such a way. But it cannot be implemented with tools/utilities that Add-in Express provides. It requires creating 1) a custom shim that will create a TLB describing the functions that Excel users may access and 2) (optionally)a custom loader to let your Automation Add-in load in the same AppDomain with your COM add-in. Currently, these can be created in the framework of our custom development services; see https://www.add-in-express.com/custom-development/index.php.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Nov, 2017 10:37:22 Top
Michael Kaden




Posts: 67
Joined: 2017-11-15
Dear Andrei,

thank you, for the time we pursue the XLL route.

kind regards

Michael
Posted 30 Nov, 2017 08:07:02 Top
Andrei Smolin


Add-in Express team


Posts: 14302
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 30 Nov, 2017 08:10:47 Top
Michael Kaden




Posts: 67
Joined: 2017-11-15
Dear Andrei,


Posted 28 Nov, 2017 06:34:24

Ha! The issue goes away if you delete WithEvents from declarations of the corresponding variables! And you may delete it if you don't use the Disposed event.


I got the same warning again on "Check Code on build" related to the ribbon components. I can change

Friend WithEvents Group01 As AddinExpress.MSO.ADXRibbonGroup
to
Friend Group01 As AddinExpress.MSO.ADXRibbonGroup


and one of the warnings goes away, but I cannot change

Friend WithEvents But001 As AddinExpress.MSO.ADXRibbonButton
to
Friend But001 As AddinExpress.MSO.ADXRibbonButton

as this raises an ERROR


BC30506 Visual Basic AND VB.NET Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

I still would prefer if the warning can be eliminated.

regards

Michael
Posted 14 Dec, 2017 06:59:59 Top
Andrei Smolin


Add-in Express team


Posts: 14302
Joined: 2006-05-11
Hello Michael,

I've reproduced the issue. We regard it as belonging to Code Analysis.

To bypass it, I deleted WithEvents from the button declaration. Now I connect to the Click event as follows:

AddinModule.Designer.vb:

    Public Sub New()
        MyBase.New()

        Application.EnableVisualStyles()

        'This call is required by the Component Designer
        InitializeComponent()

        AddHandler AdxRibbonButton1.OnClick, AddressOf AdxRibbonButton1_OnClick ' <----- connect to that event
        'Please add any initialization code to the AddinInitialize event handler

    End Sub
    Private Sub InitializeComponent()
...
        Me.AdxRibbonButton1 = New AddinExpress.MSO.ADXRibbonButton(Me.components)
...        
        'AdxRibbonButton1
        '
        Me.AdxRibbonButton1.Caption = "AdxRibbonButton1"
        Me.AdxRibbonButton1.Id = "adxRibbonButton_8698f80fecc644a98ad09a3120f1e729"
        Me.AdxRibbonButton1.ImageTransparentColor = System.Drawing.Color.Transparent
        Me.AdxRibbonButton1.Ribbons = AddinExpress.MSO.ADXRibbons.msrExcelWorkbook
...
    End Sub
...
Friend AdxRibbonButton1 As AddinExpress.MSO.ADXRibbonButton


AddinModule.vb; note that the Handles part is commented out

    Private Sub AdxRibbonButton1_OnClick(sender As Object, control As IRibbonControl, pressed As Boolean) 'Handles AdxRibbonButton1.OnClick
        ' do something here
    End Sub


I suppose Code Analysis analyses some object form of your code, not the source code itself. That object form contains details of how VB.NET actually connects to events of a WithEvents variable; I think this internal implementation causes the issue. Again, it doesn't occur with C#.

As you probably know, there's no analogs of WithEvents and Handles in C#. C# hides far less things from the developer (compared with VB.NET). The C# code that I have performs the very same thing that the VB.NET code above. As a former VB developer, I'd put it this way: the C# code "manually" connects to that event. I remember this was my very first impression when I saw C#: they want me to connect to events manually? they want me to cast everything? What's the ...

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 14 Dec, 2017 10:07:04 Top
Michael Kaden




Posts: 67
Joined: 2017-11-15
Dear Andrei,

thank you, that works.

kind regards

Michael
Posted 15 Dec, 2017 07:04:03 Top
Andrei Smolin


Add-in Express team


Posts: 14302
Joined: 2006-05-11
You are welcome!!!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 15 Dec, 2017 07:20:09 Top