Yes. U have 2 alternatives:
1) Make the ComboBox public.
To achieve this add the following code in your OCX:
Public Poperty Get MiCombo() as ComboBox
Here U make reference to the 'real' combo
Set MiCombo = ComboOCx
Where ComboOCX is the combo object placed in your control
End
2) The other possiblity (wich is more correct object oriented speaking) is to create a procedure/function that fills the combo.
Place the following code in your control:
Public Sub FillOCXCombo(icolItems as Collection)
Where icolItems is a collection with the items U wnat to add
dim i as integer
for i=1 to icolItems.Count
ComboOCX.AddItem icolItems(i)
next
End
The second method is more accurate, since it provides encapsulation (it means that U can't access a control's object directly)
Hope it helps... any doubt...
Main Topics
Browse All Topics





by: AzraSoundPosted on 2000-05-30 at 22:24:12ID: 2866313
you add items to a combobox at run-time using its additem method. for the purposes of binding a combobox to a recordset, as it appears will be the case for you, i would use the datacombo instead. go to project -> components and check off the microsoft datalist controls. one of the controls that will appear in your toolbox is the datacombo. it can be bound to data such that it is filled automatically without the need to manually add items yourself.