Difference between revisions of "A 'hello world' VB.NET program"
From Ribbon Commander Documentation
(→Creating a tab) |
(→Code Analysis) |
||
Line 51: | Line 51: | ||
== Code Analysis == | == Code Analysis == | ||
− | <syntaxhighlight lang="vb" line> | + | <syntaxhighlight lang="vb" line start="8"> |
+ | ' Instantiate a new rxCustomUI in context 'my_vb_context' | ||
+ | _customUI = rxCustomUI.create("my_vb_context", "My VB.NET context!") | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | [[rxCustomUI]] is at the top of the object model hierarchy. Here we [[Method create|instantiate]] a new [[rxCustomUI]] object in a new context with id 'my_vb_context' and description 'My VB.NET context!' |
Revision as of 18:03, 15 March 2013
Creating a tab
- Add a new class to your project and name it MyCustomUI.
- Add the following code to your class
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
- Modify class ThisAddin in ThisAddin.vb as follows
Public Class ThisAddIn
Private _myCustomUI As MyCustomUI
Private Sub ThisAddIn_Startup() Handles Me.Startup
_myCustomUI = New MyCustomUI()
End Sub
Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
End Sub
End Class
- Run the add-in. If everything went according to plan a new tab labeled 'My VB Tab' will appear when the application starts
Code Analysis
' Instantiate a new rxCustomUI in context 'my_vb_context'
_customUI = rxCustomUI.create("my_vb_context", "My VB.NET context!")
rxCustomUI is at the top of the object model hierarchy. Here we instantiate a new rxCustomUI object in a new context with id 'my_vb_context' and description 'My VB.NET context!'