Here's the IDL definition of the IUnboundHandler interface:
[
uuid(84B7F083-9CA4-4C28-A569-CD38DF32C987),
pointer_default(unique)
]
interface IUnboundHandler : IUnknown
{
[propget, id(1), helpcontext(3001), helpstring("Gets the number of items.")] HRESULT ItemsCount( IDispatch* Source, [out, retval ] long* pVal );
[id(2), helpcontext(3002), helpstring("The source requires an item.")] HRESULT ReadItem( long Index, IDispatch* Source, long ItemHandle );
}
Here's the IDL definition of the UnboundHandler interface ( this interface is available starting from the version 12.0 ):
[
uuid(84B7F083-9CA4-4C28-A569-CD38DF32C988),
]
dispinterface UnboundHandler
{
interface IUnboundHandler;
}
The following VB sample displays 20,000 items in unbound mode:
Implements EXCOMBOBOXLibCtl.IUnboundHandler
Private Sub Form_Load()
With ComboBox1
.BeginUpdate
.Columns.Add("Index").FormatColumn = "value format `0`"
Set .UnboundHandler = Me
.EndUpdate
End With
End Sub
Private Property Get IUnboundHandler_ItemsCount(ByVal Source As Object) As Long
IUnboundHandler_ItemsCount = 20000
End Property
Private Sub IUnboundHandler_ReadItem(ByVal Index As Long, ByVal Source As Object, ByVal ItemHandle As Long)
With Source.Items
.CellCaption(ItemHandle, 0) = Index + 1
End With
End Sub
The following VB/NET sample displays 20,000 items in unbound mode:
Public Class Form1
Implements EXCOMBOBOXLib.IUnboundHandler
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With AxComboBox1
.BeginUpdate()
.Columns.Add("Index").FormatColumn = "value format `0`"
.UnboundHandler = Me
.EndUpdate()
End With
End Sub
Public ReadOnly Property ItemsCount(ByVal Source As Object) As Integer Implements EXCOMBOBOXLib.IUnboundHandler.ItemsCount
Get
ItemsCount = 20000
End Get
End Property
Public Sub ReadItem(ByVal Index As Integer, ByVal Source As Object, ByVal ItemHandle As Integer) Implements EXCOMBOBOXLib.IUnboundHandler.ReadItem
With Source.Items
.CellCaption(ItemHandle, 0) = Index + 1
End With
End Sub
End Class
The following C# sample displays 20,000 items in unbound mode:
public partial class Form1 : Form, EXCOMBOBOXLib.IUnboundHandler
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
axComboBox1.BeginUpdate();
(axComboBox1.Columns.Add("Index") as EXCOMBOBOXLib.IColumn).FormatColumn = "value format `0`";
axComboBox1.UnboundHandler = this;
axComboBox1.EndUpdate();
}
public int get_ItemsCount(object Source)
{
return 1000000;
}
public void ReadItem(int Index, object Source, int ItemHandle)
{
(Source as EXCOMBOBOXLib.IComboBox).Items.set_CellCaption(ItemHandle, 0, Index + 1);
}
}
The following VFP 9 sample displays 20,000 items in unbound mode:
with thisform.ComboBox1
.Columns.Add("Index").FormatColumn = "value format `0`"
.UnboundHandler = newobject('UnboundHandler', 'class1.prg')
endwith
where the class1.prg is:
define class UnboundHandler as session OLEPUBLIC
implements IUnboundHandler in "ExComboBox.dll"
function IUnboundHandler_get_ItemsCount(Source)
return 1000000
endfunc
function IUnboundHandler_ReadItem(Index, Source, ItemHandle)
With Source.Items
.CellCaption(ItemHandle, 0) = Index + 1
EndWith
endfunc
implements UnboundHandler in "ExComboBox.dll"
function UnboundHandler_get_ItemsCount(Source)
return this.IUnboundHandler_get_ItemsCount(Source)
endfunc
function UnboundHandler_ReadItem(Index, Source, ItemHandle)
return this.IUnboundHandler_ReadItem(Index, Source, ItemHandle)
endfunc
enddefine
The following VFP 7 and VFP 8 sample displays 20,000 items in unbound mode:
with thisform.ComboBox1
.Columns.Add("Index").FormatColumn = "value format `0`"
.UnboundHandler = newobject('UnboundHandler', 'class1.prg')
endwith
where the class1.prg is:
define class UnboundHandler as custom
implements IUnboundHandler in "ExComboBox.dll"
function IUnboundHandler_get_ItemsCount(Source)
return 20000
endfunc
function IUnboundHandler_ReadItem(Index, Source, ItemHandle)
With Source.Items
.DefaultItem = ItemHandle
.CellCaption(0, 0) = Index + 1
EndWith
endfunc
enddefine
The UnboundHandler / IUnboundHandler interface requires the following
properties and methods:


| Name | Description | |||
| ItemsCount | Gets the number of items. | |||
| ReadItem | The source requires an item. |