I have an accounts database using SAGE Line50 and i have the developer SDK which uses COM to access the data
i can access some of the data ok, but i am stuck with the part that has this structure
as i cant see an equivalent of iEnumerator
Dim oSuppAdds As SageDataObject190.SupplierAddresses
Dim mySupAddsEnum As IEnumerator
oSuppAdds = ws.CreateSupplierAddresses
mySupAddsEnum = oSuppAdds.GetEnumerator()
While (mySupAddsEnum.MoveNext)
If mySupAddsEnum.Current.Supplier.Reference = txtSupplierCode.Text.ToUpper Then
MsgBox("Supplier address 1 " & mySupAddsEnum.Current.addressline1)
End If
End While
Without looking at your classes and docs for this I can’t tell for sure, but this sounds like a standard Enumerable interface. You can use this code as a suggested template on how to enumerate through the items:
[code] Dim t As New TAPI3Lib.TAPI
t.Initialize
Dim disp As COM.IDispatch = t.Addresses
Dim p As Ptr
if 0 = disp.QueryInterface( TAPI3Lib.ITCollection.IID, p ) Then
Dim c As New TAPI3Lib.ITCollection§
// Enumerate using iterator approach
Dim enumIter As New COM.IEnumVARIANT(c._NewEnum)
Dim fetched As UInt32
Dim var As Variant
Dim result As Boolean = enumIter.Next_( 1, var, fetched )
While result
If var IsA COM.IDispatch Then
disp = var
If 0 = disp.QueryInterface( TAPI3Lib.ITAddress.IID, p ) Then
Dim addr As New TAPI3Lib.ITAddress( p )
Listbox1.AddRow( addr.AddressName )
Listbox1.Cell( Listbox1.ListCount - 1, 1 ) = addr.ServiceProviderName
End If
End If
result = enumIter.Next_( 1, var, fetched )
Wend