How to empty a PopUp control

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

How to empty a PopUp control
 
Giuseppe Porcelli




Posts: 46
Joined: 2006-05-26
I fill at runtime a popUp control with many buttons.
I want to know how to emty this popUp control from all added buttons.

I tried with PopUp.controls.Delete()
but many exception fired.

I tried with a for each using the remove method of the PopUp, but also many exception fired.

giuseppe
Posted 04 Jun, 2006 06:18:02 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Giuseppe.

You can remove controls at runtime if they are connected to Outlook controls. What error messages do you get?
Posted 05 Jun, 2006 09:25:15 Top
Giuseppe Porcelli




Posts: 46
Joined: 2006-05-26
I got the following error :

Detailed technical information follows:
---
(Inner Exception)
Date and Time: 05/06/2006 19.42.40
Machine Name: PORCELLI
IP Address: 192.168.1.5
Current User: UNIPROF\giuseppe.porcelli

Application Domain: c:\Documents and Settings\Giuseppe.Porcelli\Documenti\Visual Studio 2005\AddIns\Uniprof\Uniprof\bin\Debug\
Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_32/AddinExpress.MSO.2005/2.5.1759.1__c20c070a1fc9a144/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=2.5.1759.1, Culture=neutral, PublicKeyToken=c20c070a1fc9a144
Assembly Version: 2.5.1759.1
Assembly Build Date: 25/10/2004 1.00.02

Exception Source:
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: Errore non specificato. (Eccezione da HRESULT: 0x80004005 (E_FAIL))
Exception Target Site: ForwardCallToInvokeMember

---- Stack Trace ----
System.RuntimeType.ForwardCallToInvokeMember(memberName As String, flags As BindingFlags, target As Object, aWrapperTypes As Int32[], msgData As MessageData&)
AddinExpress.MSO.2005.dll: N 0195 (0xC3) IL
AddinExpress.MSO.ICommandBarControl.Delete(Temporary As Object)
AddinExpress.MSO.2005.dll: N 00000 (0x0) JIT
AddinExpress.MSO.ADXCommandBarControl.FinalizeControl(temp As Boolean)
AddinExpress.MSO.2005.dll: N 0040 (0x28) IL
AddinExpress.MSO.ADXCommandBarControl.Delete(temp As Boolean)
AddinExpress.MSO.2005.dll: N 0008 (0x8) IL
AddinExpress.MSO.ADXCommandBarPopup.UninstallControl(control As ADXCommandBarControl)
AddinExpress.MSO.2005.dll: N 0220 (0xDC) IL
AddinExpress.MSO.ADXCommandBarPopupControlCollection.RemoveControl(control As ADXCommandBarControl)
AddinExpress.MSO.2005.dll: N 0000 (0x0) IL
AddinExpress.MSO.ADXBaseControlCollection.Remove(control As ADXCommandBarControl)
AddinExpress.MSO.2005.dll: N 0015 (0xF) IL
AddinExpress.MSO.ADXCommandBarControl.Dispose(disposing As Boolean)
AddinExpress.MSO.2005.dll: N 0026 (0x1A) IL
AddinExpress.MSO.ADXCommandBarButton.Dispose(disposing As Boolean)
AddinExpress.MSO.2005.dll: N 0000 (0x0) IL
System.ComponentModel.Component.Dispose()
AddinExpress.MSO.2005.dll: N 0000 (0x0) IL
AddinExpress.MSO.ADXBaseControlCollection.Clear()
AddinExpress.MSO.2005.dll: N 0002 (0x2) IL
Uniprof.AddinModule.SvuotaListaFiles()
AddinModule.vb: line 0280, col 09, IL 0012 (0xC)
Uniprof.AddinModule.AdxCommandBarButtonAggiornaListaFiles_Click(sender As Object)
AddinModule.vb: line 0293, col 09, IL 0001 (0x1)
AddinExpress.MSO.ADXCommandBarButton.OnButtonClick(button As ICommandBarButton, handled As Boolean&)
AddinExpress.MSO.2005.dll: N 0053 (0x35) IL



(Outer Exception)
Date and Time: 05/06/2006 19.42.40
Machine Name: PORCELLI
IP Address: 192.168.1.5
Current User: UNIPROF\giuseppe.porcelli

Application Domain: c:\Documents and Settings\Giuseppe.Porcelli\Documenti\Visual Studio 2005\AddIns\Uniprof\Uniprof\bin\Debug\
Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_32/AddinExpress.MSO.2005/2.5.1759.1__c20c070a1fc9a144/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=2.5.1759.1, Culture=neutral, PublicKeyToken=c20c070a1fc9a144
Assembly Version: 2.5.1759.1
Assembly Build Date: 25/10/2004 1.00.02

Exception Source:
Exception Type: AddinExpress.MSO.ADXExternalException
Exception Message: Error occured in the code of the add-in.
Exception Target Site: Riferimento a un oggetto non impostato su un'istanza di oggetto.

---- Stack Trace ----


Posted 05 Jun, 2006 13:19:35 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Giuseppe.

This error can appear if you are trying to clear a popup control from one of its items.
Posted 06 Jun, 2006 08:45:26 Top
Giuseppe Porcelli




Posts: 46
Joined: 2006-05-26
So at end of the day, how to empty a PopUp control ?
Posted 06 Jun, 2006 16:36:20 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05

Giuseppe, you can use the Clear method of the ADXCommandBarPopup control to remove all its items.
Posted 07 Jun, 2006 06:58:15 Top
Giuseppe Porcelli




Posts: 46
Joined: 2006-05-26
when I use it I have execption.
Posted 07 Jun, 2006 16:15:55 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Giuseppe.

Please download and try the following example:
http://www.add-in-express.com/projects/oldynamiccontrolsexample-vs2005.zip
Posted 08 Jun, 2006 09:57:49 Top