How to add items in commandbar 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=13569
Printed Date: 29 April 2025 at 2:46am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: How to add items in commandbar combobox
Posted By: eihkir
Subject: How to add items in commandbar combobox
Date Posted: 04 March 2009 at 12:49am
Hi, 
I'm using: -XP SP2 -Codejock 12.1.1 -VB 6
I've made an mdi form featured with ribbon bar, and for the ribbon design I used the codejock command bars designer and I was happy for it's result. It really looks great!
The problem for me is that, in the mdi form load procedure, after I load the command bars design, I succeeded adding some items in a combo box, But that's not the case with adding another items to another combo box in another tab but in the same command bar. VB 6 always said that "object variable or with block variable not set.
you see, the other combo box is located in another tab. Would that matter?
Here's the code:
Private Sub MDIForm_Load()
CommandBarsGlobalSettings.App = App Me.Left = GetSetting(App.Title, "Settings", "MainLeft", Me.Left) Me.Top = GetSetting(App.Title, "Settings", "MainTop", Me.Top) Me.Width = GetSetting(App.Title, "Settings", "MainWidth", Me.Width) Me.Height = GetSetting(App.Title, "Settings", "MainHeight", Me.Height) 'Loads an xcb file created by the designer CommandBars.LoadDesignerBars App.Path & "\simbakda.xcb" 'Loads nama Provinsi Dim RibbonBar As RibbonBar Set RibbonBar = CommandBars.ActiveMenuBar Dim Combo As CommandBarComboBox Set Combo = RibbonBar.FindControl(xtpControlComboBox, ID_REPORT_PROVINSI, True) Set db = OpenDatabase(App.Path & "\database.mdb") Set rs = db.OpenRecordset("provinsi") While Not rs.EOF Combo.AddItem rs!id_prov & " " & rs!nama_prov rs.MoveNext Wend db.Close Set db = Nothing 'the above code suceeded to add items to a combo box in the ribbon commandbar 'but, i can't find a way to add items to another combo box in the same commandbar but in another tab 'what should I do?
'----this produced error massage object variable or with block variable not set.
Dim Combo2 As CommandBarComboBox Set Combo2 = RibbonBar.FindControl(xtpControlComboBox, ID_REPORT_PERIODEBULAN, True) For i = 1 To 12 Combo2.AddItem MonthName(i) Next i
'----this runs well Dim StatusBar As StatusBar Set StatusBar = CommandBars.StatusBar StatusBar.Visible = True StatusBar.AddPane 0 StatusBar.AddPane ID_INDICATOR_CAPS StatusBar.AddPane ID_INDICATOR_NUM StatusBar.AddPane ID_INDICATOR_SCRL RibbonBar.EnableFrameTheme CommandBars.Options.KeyboardCuesShow = xtpKeyboardCuesShowWindowsDefault CommandBars.EnableCustomization True WorkspaceVisible = True CommandBars.ShowTabWorkspace True End Sub
How can I call the exact combo box to do some modification to it?
It's been 2 days since I haven't found the way to do it correctly. I really appreciate your help guys. Thanks A Lot.
|
Replies:
Posted By: Oleg
Date Posted: 04 March 2009 at 3:18am
Hi,
try set False for "Visible" parameter
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: eihkir
Date Posted: 04 March 2009 at 9:10am
Hi Oleg :D
Thanks for the reply, but I've finally found the solution myself. 
The problem is, the active tab. we must select the active tab first, then we can modify the control on the tab. This is how I did it:
'select the tab where the control resides RibbonBar.FindTab(ID_TAB_REPORT).Selected = True
'set the control to the one we want to modify Set Combo = RibbonBar.FindControl(xtpControlComboBox, ID_REPORT_BULAN, True)
'modify the control For I = 1 To 12 Combo.AddItem Str(I) Next I
That's It!
|
|