![]() |
Designer & Programatically filling ComboBoxs |
Post Reply ![]() |
Author | |
DigiDog ![]() Newbie ![]() ![]() Joined: 22 August 2007 Location: United States Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() Posted: 22 August 2007 at 12:37am |
I have been able to create toolbars with ComboBoxes etc. and can populate them in Designer but I need to populate the ComboBox in code. Should be simple. Can anyone help?
Many thanks
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
After you load designer file, find this combo:
CXTPControlComboBox* pCombo = (CXTPControlComboBox*)pCommandBars->FindControl(...);
and fill using pCombo->AddString method.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
DigiDog ![]() Newbie ![]() ![]() Joined: 22 August 2007 Location: United States Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg but I am affraid I need it spelled out a little more. I am not finding CXTPControlComboBox or pCommandBars. Thanks for your patience.
|
|
![]() |
|
DigiDog ![]() Newbie ![]() ![]() Joined: 22 August 2007 Location: United States Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
Oleg, I have it working partly. But I am unable to set in initial entry for the Combo Box. I get errors when using Methods that I would expect to work.
Thanks again for your help.
Dim pCombo As CommandBarComboBox
Set pCombo = CommandBars.DesignerControls.Find(, 1036) pCombo.AddItem ("Default") 'Works! pCombo.AddItem ("Profile1") 'Works! pCombo.AddItem ("Profile2") 'Works! pCombo.ListIndex = 1 'Method 'ListIndex' of object 'ICommandBarComboBox' failed 'or
pCombo.Text = "Default" 'Method 'Text' of object 'ICommandBarComboBox' failed Debug.Print pCombo.ListCount 'Works! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
you wrote in MFC forum, so I gave you MFC answer.
for ActiveX instead of CommandBars.DesignerControls.Find
use CommandBars.FindControl
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
DigiDog ![]() Newbie ![]() ![]() Joined: 22 August 2007 Location: United States Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
Sorry for the confusion. I will try to be more careful in the future. Now, how do I initialize the combo box with a selection. Nothing seems to be provided to do that. The box always comes up empty until somethng is selected via the mouse etc. I want it to come up with the entry that was there the last time the application was closed.
Many thanks |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
So Combo.ListIndex Property doesn't work for you ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
DigiDog ![]() Newbie ![]() ![]() Joined: 22 August 2007 Location: United States Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
OK, That did it. Thanks for your patient help.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |