How to add items in commandbar combobox |
Post Reply |
Author | |
eihkir
Newbie Joined: 03 March 2009 Status: Offline Points: 2 |
Post Options
Thanks(0)
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. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
try set False for "Visible" parameter
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
eihkir
Newbie Joined: 03 March 2009 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
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! |
|
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 |