Trying to make a ribbon tab active in AutoCAD 2012 using VB.NET

I am trying to write a simple program for AutoCAD 2012 using VB.NET to make a specific tab in the ribbon active but since I am very new to vb.net am having trouble with it, below is the main part of the program.  Visual Studio is giving me an error for "Home" stating:

Value of type 'String' cannot be converted to 'Autodesk.Windows.RibbonTab'

"Home" is the name of the ribbon tab which I would like to make active.
Private Sub SetRibbonTab()
   Dim ribcontrol As RibbonControl = ComponentManager.Ribbon
   ribcontrol.ActiveTab = "Home"
End Sub

Open in new window

GreyHippoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silverkornCommented:
see the discussion here:
http://forums.autodesk.com/t5/NET/How-to-Load-CUI-File-Ribbon-Tabs-And-Make-Visible-via-NET/m-p/3049040

a user had uploaded a sample code file that shows the switching of ribbon tabs
0
GreyHippoAuthor Commented:
That's what I started with but I can't figure out how to add the name of the tab to make active.
0
silverkornCommented:
as per: http://forums.autodesk.com/t5/NET/Options-Dialog-Tab-Pre-Selection/m-p/2400125/highlight/true#M12755

it appears that the ActiveTab is looking for an integer value, so try the value of 1

another example could be found here:
http://forums.autodesk.com/t5/NET/Total-n00b-trying-to-use-net-to-create-ribbon-bar-addins/m-p/2880120/highlight/true#M22189

in which they use the following code to create a new tab and set it active:
 
Private Sub CreateRibbon()
        'declare a ribboncontrol object
        Dim ribCntrl As RibbonControl = ComponentManager.Ribbon
        'create a ribbontab
        Dim ribTab As New RibbonTab()
        'set a few properties
        ribTab.Title = "AU2009"
        ribTab.Id = "AU2009"
        'add the tab to the ribbon
        ribCntrl.Tabs.Add(ribTab)
        'set as active tab
        ribTab.IsActive = True

    End Sub

Open in new window

0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

GreyHippoAuthor Commented:
I tried adding a 1 but received a similar error: "Value of type 'Integer' cannot be converted to 'Autodesk.Windows.RibbonTab' "

I found that other example but they are trying to create a new tab and making it active.

0
silverkornCommented:
after looking more closely at the code from the previous link: http://forums.autodesk.com/t5/NET/How-to-Load-CUI-File-Ribbon-Tabs-And-Make-Visible-via-NET/m-p/3049040

at the very end of the Class1.vb file in the VBExample file they have a for loop to find the tab named Autodesk and then set it active, so from there you could try this line of code to replace your line 3:

ribcontrol.Tabs.Item(0).IsActive = True
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GreyHippoAuthor Commented:
Thanks that worked
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.