Print Page | Close Window

Add items to combobox?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=680
Printed Date: 11 December 2024 at 10:49pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Add items to combobox?
Posted By: rdeboer
Subject: Add items to combobox?
Date Posted: 30 April 2004 at 4:18pm

Hi,

I load an XCB file which has a toolbar with a combobox.

How do I add items to this combobox in vb code?

 

 




Replies:
Posted By: robs
Date Posted: 01 May 2004 at 11:00am

Take a look at DynamicPopups sample. CommandBars_InitCommandsPopup procedure. Use AddItem method of CommandBarComboBox object. You may have to use .FindControl  method of CommandBars to find your CommandBarComboBox object.

Set ControlComboBox = CommandBar.FindControl(, Id, , True)

ControlComboBox.AddItem itemText

Good luck

 

 



Posted By: rdeboer
Date Posted: 01 May 2004 at 11:21am

Thanks, but in this case the items are only added when someone clicks on the combobox?

I need to add items (in this case cd devices) into the combobox without any user interaction, and the first item (device) should be displayed.

 



Posted By: robs
Date Posted: 01 May 2004 at 11:26am

Right,

So in form_load or whatever:

Dim ControlComboBox as CommandBarComboBox

Set ControlComboBox = CommandBar.FindControl(,Id,,True)

If not ControlComboBox is nothing then

    ContgrolComboBox.AddItem itemText

End if

Something like that.



Posted By: rdeboer
Date Posted: 01 May 2004 at 11:34am

That did the trick!

Thanks!

 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net