Difference between revisions of "A 'hello world' VB.NET program"

From Ribbon Commander Documentation
Jump to: navigation, search
(Creating a tab)
Line 3: Line 3:
 
* Add the following code to your class
 
* Add the following code to your class
 
<syntaxhighlight lang="vb" line>
 
<syntaxhighlight lang="vb" line>
 +
Imports LogismiX.Interop.DynamicRibbonX
 +
Imports LogismiX.DynamicRibbonX.Core
 +
 +
Public Class MyCustomUI
 +
    Dim _customUI As rxCustomUI
 +
 +
    Public Sub New()
 +
        ' Instantiate a new rxCustomUI in context 'my_vb_context'
 +
        _customUI = rxCustomUI.create("my_vb_context", "My VB.NET context!")
 +
 +
        ' Cache a reference to the customUI's ribbon
 +
        Dim myRibbon As rxRibbon = _customUI.ribbon
 +
 +
        ' Create a new tab and label it 'My VB Tab'
 +
        Dim myTab As rxTab = New rxTab()
 +
        myTab.label = "My VB Tab"
 +
 +
        ' Add the tab to myRibbon's tabs
 +
        myRibbon.tabs.add(myTab)
 +
 +
        ' Render the UI
 +
        _customUI.refresh()
 +
 +
    End Sub
 +
 +
End Class
 +
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 17:53, 15 March 2013

Creating a tab

  • Add a new class to your project and name it MyCustomUI.
  • Add the following code to your class
  1. Imports LogismiX.Interop.DynamicRibbonX
  2. Imports LogismiX.DynamicRibbonX.Core
  3.  
  4. Public Class MyCustomUI
  5.     Dim _customUI As rxCustomUI
  6.  
  7.     Public Sub New()
  8.         ' Instantiate a new rxCustomUI in context 'my_vb_context'
  9.         _customUI = rxCustomUI.create("my_vb_context", "My VB.NET context!")
  10.  
  11.         ' Cache a reference to the customUI's ribbon
  12.         Dim myRibbon As rxRibbon = _customUI.ribbon
  13.  
  14.         ' Create a new tab and label it 'My VB Tab'
  15.         Dim myTab As rxTab = New rxTab()
  16.         myTab.label = "My VB Tab"
  17.  
  18.         ' Add the tab to myRibbon's tabs
  19.         myRibbon.tabs.add(myTab)
  20.  
  21.         ' Render the UI
  22.         _customUI.refresh()
  23.  
  24.     End Sub
  25.  
  26. End Class