Print Page | Close Window

Combo Box??!!

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=17038
Printed Date: 06 October 2024 at 8:38am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Combo Box??!!
Posted By: anthony_pacitto
Subject: Combo Box??!!
Date Posted: 31 July 2010 at 12:30am
Hey, Just wondering...what is the correct code in VB6 to add items to a xtpControlComboBox (ComboBox) that i have located inside my command bar. I need it so that when the form loads it will automatically add items to the combobox...How do i do this! Please help! Thnx.



Replies:
Posted By: Xander75
Date Posted: 18 August 2010 at 4:20am
Hi,

When setting up a Combobox in the Commandbar use the following code example to add items. There are a few ways in which you can add items...


Dim Combo As XtremeCommandBars.CommandBarComboBox
Set Combo = .Add(xtpControlComboBox, ID_GOES_HERE, "")

' Adding items manually, i.e. a static list of data
With Combo
    .AddItem = "Row 1"
    .AddItem = "Row 2"
End With

' Adding items using a For Loop
For i = 1 To 10
    Combo.AddItem "Item " & i
Next

Dim rs As New ADODB.Recordset
Set rs = cnConn.Execute("SQL Query goes here...")

' Adding items using a Recordset
Do While Not rs.EOF
    Combo.AddItem rs("Value")
    rs.MoveNext
Loop

Hope this helps!



-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)



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