ComboBox in Ribbon Panel with vb.net

ComboBox in Ribbon Panel with vb.net

Martin-Winkler-Consulting
Advisor Advisor
1,230 Views
12 Replies
Message 1 of 13

ComboBox in Ribbon Panel with vb.net

Martin-Winkler-Consulting
Advisor
Advisor

Hi, iam trying to implement a ComboBox into a user defined additional Inventor Ribbon Panel. The ComboBox is shown in the panel with its entries. But iam not able to catch the selected entry when it is clicked.

I implemented the Combobox in the AddinServer Class with

Public WithEvents comboBox1 As ComboBoxDefinition
......
'Definition ComboBox
comboBox1 = AddinGlobal.InventorApp.CommandManager.ControlDefinitions.AddComboBoxDefinition(
                        My.Resources.Browsernamen_wiederherstellen,
                        My.Resources.BrowserNameUpdate,
                        CommandTypesEnum.kQueryOnlyCmdType,
                        400, Guid.NewGuid().ToString(),
                        "Browsernanmen wiederherstellen", "Stellt den ursprünglichen Display Namen der zugehörigen Datei wieder her",
                        ButtonDisplayEnum.kDisplayTextInLearningMode)

                    comboBox1.AddItem(My.Resources.Alle_Browsernamen_wiederherste)
                    comboBox1.AddItem(My.Resources.selektierte_Browsernamen_wiede)
                    comboBox1.AddItem("ComboBoxItem #3")
                    comboBox1.DescriptionText = My.Resources.Browsernamen_wieder_herstellen
                    comboBox1.ListIndex = 2
.........
 'Add it to the Browser Panel
 'Buttons in Ribbon Panel Browser hinzufügen (Tab "Browser")
                            AddinGlobal.RibbonPanel3DCSBrowserId = "{D2554A9F-2EEB-477B-A469-D40FBE606866}" 'MLHIDE
                            AddinGlobal.RibbonPanel3DCSBrowser = tabBrowser.RibbonPanels.Add(My.Resources.Browser_Panel, "GeneralTools_3DCS_AddIn.RibbonPanel_" & Guid.NewGuid().ToString(), AddinGlobal.RibbonPanel3DCSBrowserId, String.Empty, True) 'MLHIDE
                            Dim cmdCtrlsBrowser As CommandControls = AddinGlobal.RibbonPanel3DCSBrowser.CommandControls
                            cmdCtrlsBrowser.AddComboBox(comboBox1)

When i try to sent the OnSelect Event from AddIn class to my class ButtonActions i couldn't catch the NameValueMap

AddHandler comboBox1.OnSelect, AddressOf ButtonActions.ComboBox1_Execute3

With Buttons it works fine but there is no NameValueMap, for example:

buttonPart5.Execute = AddressOf ButtonActions.buttonPart5_Execute

Did anyone has an idea in which way i have to handle the OnSelect event and receiving the selected Index of the ComboBox from the NameValueMap?

 

 

 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Accepted solutions (2)
1,231 Views
12 Replies
Replies (12)
Message 2 of 13

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Private Sub ComboBox1_OnSelect(Context As NameValueMap) Handles ComboBox1.OnSelect
            MsgBox(Context.Text)
        End Sub
    End Class

Add this to your code and remove the handler... 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 13

Thanks at @bradeneuropeArthur

i tried it, but the Context is empty.


Context_Empty.jpg
MsgBox(Context.Text)

fires an exception because there is Nothing.

Is the AddinServer the correct place monitoring the event object?

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 4 of 13

you wrote Msgbox ("event handler")

 

For me the code worked fine I have tested...

 

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 13

bradeneuropeArthur
Mentor
Mentor

this is needed

 

Private Sub ComboBox1_OnSelect(Context As NameValueMap) Handles ComboBox1.OnSelect
            MsgBox(Context.Text)
        End Sub
    End Class

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 13

This is the Result here using Context.Text:

Context_Empty2.jpg

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 7 of 13

What inventor version are you using?

what framework do you use?

What references are missing?

 

the code works fine by my add ins!!!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 8 of 13

Inventor 2018

Visual Studio Community 2017

I think references are fine, all other stuff works

I will try it in another test project and with VS 2015

 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 9 of 13

VS 2017 is not supported.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 10 of 13

bradeneuropeArthur
Mentor
Mentor

Combobox.PNG

I use VS 2015, because of issues with VS 2017.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 11 of 13

Smiley Frustrated

same with VS2015. There has to be another reason.

VS Studio2015_1.jpg

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 12 of 13

Try to Use a different framework....

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 13 of 13

Martin-Winkler-Consulting
Advisor
Advisor
Accepted solution

@bradeneuropeArthur

thanks for your help and your solution. It was a good inspiration.

I made a workarround and could get this version which works properly in my AddinServer Class

First i declared comboBox1 as Public with Events

Public Class FreeTools_3DCS
    Implements Inventor.ApplicationAddInServer
    Public WithEvents comboBox1 As ComboBoxDefinition
.........

then defined it and AddHandler to a Sub ComboBox1_OnSelect() in the same Addin Server Class

 

'Combo Box Definitions
                comboBox1 = AddinGlobal.InventorApp.CommandManager.ControlDefinitions.AddComboBoxDefinition(
                        "Value1", "Value2", CommandTypesEnum.kQueryOnlyCmdType,
                        400, Guid.NewGuid().ToString(),
                        "Browsernanmen wiederherstellen", "Stellt den ursprünglichen Display Namen der zugehörigen Datei wieder her",
                        ButtonDisplayEnum.kDisplayTextInLearningMode)

                comboBox1.AddItem("Value1")
                comboBox1.AddItem("Value2")
                comboBox1.AddItem("ComboBoxItem #3")
                comboBox1.DescriptionText = "Test ComboBox"
                comboBox1.ListIndex = 1
                AddHandler comboBox1.OnSelect, AddressOf ComboBox1_OnSelect

then got it in this Sub

Private Sub ComboBox1_OnSelect()
 MsgBox(comboBox1.Text & " - " & comboBox1.ListIndex.ToString)
End Sub

and here is the result:

ComboBox_Action.jpg

 

 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes