Vb.net 如何(以编程方式)将图像添加到axmscomctlib.AxImageList并将图像列表绑定到axmscomctlib.AxToolbar

Vb.net 如何(以编程方式)将图像添加到axmscomctlib.AxImageList并将图像列表绑定到axmscomctlib.AxToolbar,vb.net,vb6,Vb.net,Vb6,我正在开发.NET应用程序。以及使用一些vb6常用控件 在设计模式下,我可以创建图像列表并将其附加到工具栏控件 但是当我通过编程添加工具栏按钮时 Toolbar.Buttons.Add(,“tbsave”,“Save”,mscomctlib.ButtonStyleConstants.tbrDefault,toolbarImages.ListImages(1).Picture) 获取异常“无效密钥” 不是 有什么想法吗?? 谢谢你在.NET中思考。用VB6代替 dim nIndex as long

我正在开发.NET应用程序。以及使用一些vb6常用控件

在设计模式下,我可以创建图像列表并将其附加到工具栏控件 但是当我通过编程添加工具栏按钮时

Toolbar.Buttons.Add(,“tbsave”,“Save”,mscomctlib.ButtonStyleConstants.tbrDefault,toolbarImages.ListImages(1).Picture)

获取异常“无效密钥” 不是

有什么想法吗??
谢谢你在.NET中思考。用VB6代替

dim nIndex as long 
nIndex = 4  ' this is the index of your image in the ImageList control.
            ' The code assumes that you already assigned the ImageList
            ' to the Toolbar.ImageList property

Toolbar.Buttons.Add(, "tbsave", "Save", MSComctlLib.ButtonStyleConstants.tbrDefault, nIndex)