ICommandBar vs. IToolBarDef

Discussion created by gkar68 on Jan 31, 2013
Latest reply on Feb 5, 2013 by gkar68
I am migrating .NET, C# code for custom extension from version 9.3 to 10.1.
The code is creating many toolbars on the fly and add commands to them.

The code snippets for creating one toolbar is like follows:

    ICommandBars bars = m_application.Document.CommandBars;
    ICommandBar newBar = bars.Create("my new toolbar",  esriCmdBarType.esriCmdBarTypeToolbar);
    UID uid = new UIDClass();
    uid.Value = "{E1F29C6B-4E6B-11D2-AE2C-080009EC732A}";
    object index = 0;
    newBar.Add(uid, ref index);
    newBar.Dock(dockstyle, referencetoolbar);

so the above code works fine for 9.3
But when I recompile it on 10.1 , it produce an empty toolbar that has nothing.
I investigate, and found out that the command "Dock" is corrupting the toolbar.

So, without Dock, the toolbar is created properly

I am reading on ArcObjects, and the documentation of ICommandBars.Create, says that this will create VBA toolbar, and if you are using non VBA platform, then use IToolBarDef instead.

So, is this command (ICommandBars.Create) is not supported with 10.1 and .NET?