Nesting dynamically created buttons in dynamically created popups

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

Nesting dynamically created buttons in dynamically created popups
error creating buttons under popups when dynamic 
James Bambrough

Posts: 3
Joined: 2006-04-06

I have a application that is dynamically building a collection of popups under a popup. Within this popup, there needs to be buttons. All of this needs to be created dynamically.

I am getting an unhandled exception, and I can't work out why. Any help would be gratefully recieved!



Private Sub getContacts()
        Dim cInfo As OSSDKWS.ContactInfo
        Dim dInfo As OSSDKWS.DeviceInfo
        Dim dcontext As OSSDKWS.DeviceContextInfo
        Dim newContact As New AddinExpress.MSO.ADXCommandBarPopup
        Dim newButton As New AddinExpress.MSO.ADXCommandBarButton
        Dim tmpStr As String
        Dim tmpCollection As New AddinExpress.MSO.ADXCommandBarPopupControlCollection(newContact)

        For Each cInfo In ossdkPWS.PAGetUserContactList(strCHandle, strPrimaryURI, OSSDKWS.ContactResponseType.UserContext, True)
            newContact = New AddinExpress.MSO.ADXCommandBarPopup
            newContact.Caption = "new user"
            tmpStr = cInfo.userInfo.displayName & " (" & cInfo.contextInfo.identityContextText & ")"
            newContact.Caption = tmpStr
            'now create availability information
            For Each dInfo In cInfo.contextInfo.deviceInfoSet
                newButton = New AddinExpress.MSO.ADXCommandBarButton()
                newButton.Caption = dInfo.deviceType & " - " & dInfo.deviceContext.contextText
                newButton = Nothing
            newContact = Nothing
    End Sub
Posted 18 Dec, 2006 21:10:39 Top
Sergey Grischenko

Add-in Express team

Posts: 7233
Joined: 2004-07-05
Hi James.

The fact is that you use methods that are not designed working at runtime. Please download the following example to learn how you can add controls at runtime:

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 19 Dec, 2006 10:37:40 Top