UpdateCommandBarObj vb.net argument

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

UpdateCommandBarObj vb.net argument
 
wiemer kuik




Posts: 24
Joined: 2010-04-02
:?: Hi,
I'm trying to change the caption of a button in runtime, using updatecommandbarobj. My newbie question is: what argument should i use or how do I refer to the current addinmodule?
thanks!
Posted 03 Apr, 2010 01:52:52 Top
Andrei Smolin


Add-in Express team


Posts: 16827
Joined: 2006-05-11
Hi Wiemer,

In a test project, I've used the following code with no problem:

private AddinExpress.MSO.ADXCommandBarButton adxCommandBarButton1;
private AddinExpress.MSO.ADXCommandBarButton adxCommandBarButton2;
//...
private void adxCommandBarButton2_Click(object sender)
{
    adxCommandBarButton1.Caption = "qqq";
}


Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Apr, 2010 11:29:41 Top
wiemer kuik




Posts: 24
Joined: 2010-04-02
HI Andrei,
thanks, any chance you have the same in visual basic, this looks like C to me.
trying to change the caption of a toolbar that I've created in the addinmodule.vb via the designer
Me.AdxCommandBarButton1 = New AddinExpress.MSO.ADXCommandBarButton(Me.components)

thx!
Posted 05 Apr, 2010 11:57:03 Top
Andrei Smolin


Add-in Express team


Posts: 16827
Joined: 2006-05-11
Hi Wiemer,

Every day I create 3-5 sample projects :)

Imports System.Runtime.InteropServices
Imports System.ComponentModel

'Add-in Express Add-in Module
<GuidAttribute("2B18646B-98C4-4245-93D7-E82A0DF1F6AA"), ProgIdAttribute("MyAddin112.AddinModule")> _
Public Class AddinModule
    Inherits AddinExpress.MSO.ADXAddinModule
 
    Friend WithEvents AdxCommandBar1 As AddinExpress.MSO.ADXCommandBar
    Friend WithEvents AdxCommandBarButton1 As AddinExpress.MSO.ADXCommandBarButton
    Friend WithEvents AdxCommandBarButton2 As AddinExpress.MSO.ADXCommandBarButton
#Region " Component Designer generated code. "
    'Required by designer
    Private components As System.ComponentModel.IContainer

    'Required by designer - do not modify
    'the following method
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.AdxCommandBar1 = New AddinExpress.MSO.ADXCommandBar(Me.components)
        Me.AdxCommandBarButton1 = New AddinExpress.MSO.ADXCommandBarButton(Me.components)
        Me.AdxCommandBarButton2 = New AddinExpress.MSO.ADXCommandBarButton(Me.components)
        '
        'AdxCommandBar1
        '
        Me.AdxCommandBar1.CommandBarName = "AdxCommandBar1"
        Me.AdxCommandBar1.CommandBarTag = "4645b339-b4cc-424d-ac1b-c1753c50c600"
        Me.AdxCommandBar1.Controls.Add(Me.AdxCommandBarButton1)
        Me.AdxCommandBar1.Controls.Add(Me.AdxCommandBarButton2)
        Me.AdxCommandBar1.UpdateCounter = 2
        '
        'AdxCommandBarButton1
        '
        Me.AdxCommandBarButton1.Caption = "AdxCommandBarButton1"
        Me.AdxCommandBarButton1.ControlTag = "751894ba-5451-4532-af93-6869417a381b"
        Me.AdxCommandBarButton1.ImageTransparentColor = System.Drawing.Color.Transparent
        '
        'AdxCommandBarButton2
        '
        Me.AdxCommandBarButton2.Caption = "AdxCommandBarButton2"
        Me.AdxCommandBarButton2.ControlTag = "fbfea76a-b393-4119-b9b8-ec8c031f2e63"
        Me.AdxCommandBarButton2.ImageTransparentColor = System.Drawing.Color.Transparent
        Me.AdxCommandBarButton2.UpdateCounter = 2
        '
        'AddinModule
        '
        Me.AddinName = "MyAddin112"
        Me.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaProject

    End Sub

#End Region
 
#Region " Add-in Express automatic code "
 
    'Required by Add-in Express - do not modify
    'the methods within this region
 
    Public Overrides Function GetContainer() As System.ComponentModel.IContainer
        If components Is Nothing Then
            components = New System.ComponentModel.Container
        End If
        GetContainer = components
    End Function
 
    <ComRegisterFunctionAttribute()> _
    Public Shared Sub AddinRegister(ByVal t As Type)
        AddinExpress.MSO.ADXAddinModule.ADXRegister(t)
    End Sub
 
    <ComUnregisterFunctionAttribute()> _
    Public Shared Sub AddinUnregister(ByVal t As Type)
        AddinExpress.MSO.ADXAddinModule.ADXUnregister(t)
    End Sub
 
    Public Overrides Sub UninstallControls()
        MyBase.UninstallControls()
    End Sub
 
#End Region
 
    Public Sub New()
        MyBase.New()
 
        'This call is required by the Component Designer
        InitializeComponent()
 
        'Please add any initialization code to the AddinInitialize event handler
 
    End Sub

    Public ReadOnly Property MSProjectApp() As MSProject._MSProject
        Get
            Return CType(HostApplication, MSProject._MSProject)
        End Get
    End Property

    Private Sub AdxCommandBarButton2_Click(ByVal sender As System.Object) Handles AdxCommandBarButton2.Click
        AdxCommandBarButton1.Caption = "qqq"
    End Sub
End Class


Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Apr, 2010 13:03:44 Top
wiemer kuik




Posts: 24
Joined: 2010-04-02
It works! great, thank you!
Posted 06 Apr, 2010 05:54:42 Top