We then call .GetFullAddressLineForSelection()
to get each line to display, and keep the PostcodeLite object alive,
since it knows the ID's which match the lines displayed.
Example code : Visual Basic :
Dim PostCodeLite As Object, ReturnedData as string
Set PostCodeLite = CreateObject("IPostCodeLite.PostCode")
With PostCodeLite
List.clear
PostcodeToSearchFor = "PE13 2QL"
If .GetFullAddressToList (PostcodeToSearchFor,"I_HDI7...HU7ID","","") Then
'Process data
Line = .GetFullAddressLineForSelection()
do until Line = ""
'Add each line to
list box
list.AddItem (Line)
Line = .GetFullAddressLineForSelection()
loop
Else
If .General_errormessage <> ""
Then
'Show/Handle
any errors
MsgBox .General_credits_display_text &
vbCrLf & .General_errormessage, _
vbCritical, "Postcode Lite"
Else
MsgBox "Not found!"
End If
End If
'Show Credit/License in form caption
Me.Caption = .General_credits_display_text
End With
'Note : we keep the object alive for next part of
search
Stage 2 : Get the address information for
selected line
Function : GetFullAddressRecord(SelectedListIndex as long) as string
Parameter |
Description |
SelectedListIndex |
The index
of the line chosen. 0 for the first line. |
Returns:
This function returns true if search returned valid data, else
.General_errormessage will contain the
error, and .General_credits_display_text
if problem with license.
This PostCodeLite Object contains the following properties:
Property |
Description |
General_errormessage |
Error Message if error |
General_credits_display_text |
Number of Credits/Users available |
Address_Organisation
Address_Line1
Address_Line2
Address_Line3
Address_Town
Address_County
Address_Postcode
Address_Country
|
These properties contain
the correctly formatted address record. |
Example code : Visual Basic :
With PostCodeLite
SelectedListIndex = list.ListIndex
If .GetFullAddressRecord (SelectedListIndex) Then
'Process data
Dim DataToShow$
DataToShow = "Data Returned : " & vbCrLf
DataToShow = DataToShow & " Status : " & .General_credits_display_text
& vbCrLf
DataToShow = DataToShow & " accountadminpage : " & .General_accountadminpage
& vbCrLf
DataToShow = DataToShow & "" & vbCrLf
DataToShow = DataToShow & " Company : " & .Address_Organisation
& vbCrLf
DataToShow = DataToShow & " line1 : " & .Address_Line1 &
vbCrLf
DataToShow = DataToShow & " line2 : " & .Address_Line2 &
vbCrLf
DataToShow = DataToShow & " line3 : " & .Address_Line3 &
vbCrLf
DataToShow = DataToShow & " town : " & .Address_Town & vbCrLf
DataToShow = DataToShow & " county : " & .Address_County &
vbCrLf
DataToShow = DataToShow & " postcode : " & .Address_Postcode
& vbCrLf
DataToShow = DataToShow & " country : " & .Address_Country &
vbCrLf
msgbox DataToShow
Else
'Show/Handle any errors
MsgBox .General_credits_display_text & vbCrLf & .General_errormessage,
vbCritical,
"Postcode Lite"
End If
'Show Credit/License in form caption
Me.Caption = .General_credits_display_text
End With
Set PostCodeLite = Nothing
|