Access Ribbon Property from Windows Form

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

Access Ribbon Property from Windows Form
 
Albert Siagian




Posts: 83
Joined: 2012-05-25
Hello,

I have an Addin Module, and a ribbon named "AdxRibbonTab1". Inside this ribbon, I have a label named "AdxRibbonLabel1".

I created a Windows form named "Form1", and a button named "Button1". This forms is called from the ribbon using ShowDialog (this part works fine).

My question is, when I click Button1 on Form1, I want to change the caption label of AdxRibbonLabel1 (i.e. set AdxRibbonLabel1.caption = "ABCD"). How can I do this ?

If possible, please advise solution usingan VB.NET.

Thanks in advance.
Posted 21 Jun, 2012 22:22:30 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
Hello Albert,

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MyAddin129.AddinModule.CurrentInstance.AdxRibbonLabel1.Caption = System.DateTime.Now.ToString()
    End Sub


Note that because Forms is opened modally (via ShowDialog), the label will actually change only after the form is closed. This is how modal forms are implemented in Windows. To let the labe to change immediately, consider showing a pane instead.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2012 01:38:26 Top
Albert Siagian




Posts: 83
Joined: 2012-05-25
It works, thanks. The solution is okay, because the form is actually a login Window, so it has to be modal. Once user is validated and form is closed, then I change the caption on ribbon to display user name (i.e. "User name : John").

Regards.
Posted 22 Jun, 2012 02:19:13 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
You are weclome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2012 02:37:45 Top