Difference between revisions of "Creating our first button in VB.NET"
From Ribbon Commander Documentation
(Created page with "== Prerequisites == We recommend you go through A 'hello world' VB.NET program before going into this example. == Creating a button == * Add a new class to [[Creating a n...") |
(→Creating a button) |
||
Line 7: | Line 7: | ||
<syntaxhighlight lang="vb" line> | <syntaxhighlight lang="vb" line> | ||
+ | Imports LogismiX.Interop.DynamicRibbonX | ||
+ | Imports LogismiX.DynamicRibbonX.Core | ||
+ | |||
+ | Public Class MyCustomUI2 | ||
+ | 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!") | ||
+ | |||
+ | With _customUI | ||
+ | ' Clear old state in the context | ||
+ | .clear() | ||
+ | |||
+ | ' Add a new tab and label it | ||
+ | With .ribbon.tabs.add(New rxTab()) | ||
+ | .label = "My VB Tab" | ||
+ | |||
+ | ' Add a new group and label it | ||
+ | With .groups.add(New rxGroup()) | ||
+ | .label = "My VB Group" | ||
+ | |||
+ | 'Add a new button an label it | ||
+ | With .buttons.add(New rxButton()) | ||
+ | .label = "My VB Button" | ||
+ | End With | ||
+ | |||
+ | End With | ||
+ | End With | ||
+ | |||
+ | ' Render the UI | ||
+ | .refresh() | ||
+ | End With | ||
+ | End Sub | ||
+ | |||
+ | End Class | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 18:16, 15 March 2013
Prerequisites
We recommend you go through A 'hello world' VB.NET program before going into this example.
Creating a button
- Add a new class to your project and name it MyCustomUI2
- Add the following code to your class
Imports LogismiX.Interop.DynamicRibbonX
Imports LogismiX.DynamicRibbonX.Core
Public Class MyCustomUI2
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!")
With _customUI
' Clear old state in the context
.clear()
' Add a new tab and label it
With .ribbon.tabs.add(New rxTab())
.label = "My VB Tab"
' Add a new group and label it
With .groups.add(New rxGroup())
.label = "My VB Group"
'Add a new button an label it
With .buttons.add(New rxButton())
.label = "My VB Button"
End With
End With
End With
' Render the UI
.refresh()
End With
End Sub
End Class