Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - How to add items in commandbar combobox
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add items in commandbar combobox

 Post Reply Post Reply
Author
Message
eihkir View Drop Down
Newbie
Newbie
Avatar

Joined: 03 March 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote eihkir Quote  Post ReplyReply Direct Link To This Post Topic: How to add items in commandbar combobox
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 March 2009 at 3:18am
Hi,
 
try set False for "Visible" parameter
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
eihkir View Drop Down
Newbie
Newbie
Avatar

Joined: 03 March 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote eihkir Quote  Post ReplyReply Direct Link To This Post 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! 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.