Full address finder using the COM Object
Full Address Search functionality:
- Postcode is entered in software by user, to search for
- List of addresses, at postcode, is displayed for selection
- Address Line is selected
- Full address returned and used by software
When using the COM Object, to search by Postcode to get Full address, we have two choices of implementation:
- Using the COM user interface, for fast and easy implementation (including advanced word search)
- Use COM Object to retrieve address data, but implement your own user interface
Full Address using the COM Object user interface:
Step 1 Sign up for 30 day trial
Simply use the "Sign Up for Trial" link at top right of this page to open a trial account. We will then send you a data key, which is used to identify your account, when using the following service.
Step 2 Download COM Object
The COM Object is for use with any COM complient language. It is written in Framework V2.0 so compatible with any framework from 2 upwards. It is almost identical to our COM object, but is implemented as a .NET Assembly. It is therefore easier to distribute within your .NET project, since it requires no extra files.
The Postcode Software COM Object is in the “COM Object\COM Object Files” directory of our api example code, or installed using the InstallSimplyPostcodeCOM.EXE install program found in the route of the download.
How to distribute
Best Option
Simply include the “InstallSimplyPostcodeCOM.EXE” in your installation routine. This installs all files need, without any prompt for user input. Therefore can easily be activated by your own install routines. On most computers it will only install SimplyPostCodeLookup.dll into system32 directory, since all other files are bundled with MS Office, and other vb6 programs.
Include actual files in your own install
Place all required files in your own install routine, include all files in the "COM Object\COM Object Files" directory of the Programming examples.
These files are:
- "Microsoft Internet Transfer Control (MSINET.OCX)" OCX control
- Msvbvm60.dll to be in application directory
- mscomctl.ocx to be in application directory
- SimplyPostCodeLookup.dll
Step 3 Creating the COM Object
Add a COM Reference to our COM object, “ISimplyPostCodeCOMClass”SimplyPostCodeLookup.dll, within your programming language.
VB6/VB.Net |
Dim SimplyPostCodeLookup As New SimplyPostCode |
Step 4 Specify the Data Key
The Data Key will have been sent to you via an e-mail when you opened the account. It is also available under the “Data Key” tab of the online admin window. For the .NET Assembly you should use the data key beginning with "I_".
VB6/VB.Net |
SimplyPostCodeLookup.SetDataKey(“I_KD352jKKHhk2GAFFKDU”) |
Step 5 Call SearchForFullAddressWithDialogue to display search window
Simply call SearchForFullAddressWithDialogue(PostcodePrima, Caption, ShowLicienceDetails, AllowManageAccount, DisplayErrors)
This call can be used with Local Data or Internet based data. But when using Local Data the advanced search is not available.
This function call will display a dialogue box for the user to enter the postcode to search for (or particial address words if using our Web Based data). The user then presses the [FIND] button, and a list of possible addresses is displayed for the entered postcode. The user selects an appropriate address record and the address is returned.
Parameters
Parameter name | Description |
---|---|
PostcodePrima As String | allows you to initiate the search when opened |
Caption As String | allows the dialogue to show License status. It is good practice to show this information |
ShowLicienceDetails As Boolean | allows the use to go to their on line account to purchase more licenses |
AllowManageAccount As Boolean | allows program to show errors. If off then will simply close and return errors in General_credits_display_text and General_errormessage |
Returns
Returns true if address search completed and General_credits_display_text contains summary of Credits/License status.
Postcode Lookup Example:
This code displays the following Postcode Address Lookup window:
VB6 |
Function GetAddressByPostcode() As Boolean |
VB.Net |
'Set Data key, to identify your account |
C# .NET |
//Set Data key, to identify your account |
Advanced Search Example:
This function adds an [Advanced Find] button to the search window provided by SearchForFullAddressWithDialogue call (See previous section). This allows users to enter address words to search for, to return Full address information:
When the [Advanced Find] button is pressed the following is displayed:
Results:
This advanced word search call can ONLY be used with Internet based data
Step 6 Testing
Final step is to test, to enable easy testing please use our special test postcodes.
See section below for detail on data returned
Postcode Lookup Software Full Address - Example Code
Simply download the example code. The code is in the "COM Object/C++ COM Object","COM Object/MS Access 2000 onwards","COM Object/MS Excel using COM", "COM Object/VB6 COM Example","COM Object/VBNET COM 2005" directory of our example downloads.
You must run InstallSimplyPostcodeCOM.EXE included in the above download.
These examples demonstrate postcode lookup software using Full Address.
Full Address using the COM Object and implement your own User Interface:
Firtsly follow steps 1,2,3 and 4 above. Indeed the section above shows the princile behind this searching method.
Step 5 Present a list fo addreses from postcode entered
Simply call GetFullAddressToList(Postcode), with the Postcode the user has entered in search box.
This call can be used with Local Data or Internet based data.
Parameters
Parameter name | Description |
---|---|
Postcode as string | Postcode to find. If using our Internet based data, then the user can enter words, and wildcard, to search for address data. |
Returns
Returns true if address search completed and General_credits_display_text contains summary of Credits/License status. Else errors reported in General_errormessage.
Step 6 Call for each line to display
And then call GetFullAddressLineForSelection() to get each line for list selection for display, discussed in next section.
Example search code
VB.Net |
'Set Data key, to identify your account Me.ListBox1.Items.Clear() With SimplyPostCodeLookup If .GetFullAddressToList(Me.txtPostcode.Text) Then 'Now Populate the List box Else Me.Text = "Simply Postcode Lookup : " & .General_credits_display_text end With
|
C# .NET |
string DataKey; ListBox1.Items.Clear(); string PostCodeToFind = txtPostcode.Text; //Now Populate the List box } else { this.Text = "Simply Postcode Lookup : " + |
Step 7 Get Address Reord Selected
Now get Address record, when user double clicks on address line in selection box
Calling GetFullAddressRecord(SelectedListIndex as long)
Parameters
Parameter name | Description |
---|---|
SelectedListIndex as long | The index number of the item selected in the listbox. Zero being the first item on the list |
Returns
Returns true if address search completed and General_credits_display_text contains summary of Credits/License status. Else errors reported in General_errormessage.
Example get address record
VB.Net |
With SimplyPostCodeLookup Me.CompanyName.text = .Address_Organisation Else Me.Text = "Simply Postcode Lookup : " & .General_credits_display_text |
C# .NET |
int SelectedIndex=ListBox1.SelectedIndex; } else { |
Step 8 Testing
Final step is to test, to enable easy testing please use our special test postcodes.
Postcode Software Full Address - Example Code
Simply download the example code. The code is in the "COM Object/C++ COM Object","COM Object/MS Access 2000 onwards","COM Object/MS Excel using COM", "COM Object/VB6 COM Example","COM Object/VBNET COM 2005" directory of our example downloads.
You must run InstallSimplyPostcodeCOM.EXE included in the above download.
These examples demonstrate postcode lookup software using Full Address your own User Interface.
Data Returned:
This type of license returns: (see example below)
- ID
- CompanyName
- Line1
- Line2
- Line3
- Town
- CountyState
- PostZipCode
- Country "England","Wales","Northern Ireland","Isle of Man","Channel Islands","Scotland"
- MailSort ●
- Unique ●
- DeliveryPointSuffix ●
- NoHouseHolds ●
- UDPRN ● (Royal mail unique id for each address)
- Spare ●
● see Additional Data Returned by Postcode Finder API for more information
The following return the status of the account and search:
Public General_confirm As Boolean
'True if address data returned
Public General_credits_display_text As String
'Shows number of Credits/Users available
Public General_accountadminpage As String
'Gives URL of online account admin page
'From here the customer can be more Credits/Licenses
Public General_errormessage As String
'Error Message if error
Public General_credits_display_showbutton As Boolean
'True if should show button to buy more Credits/Licenses OPTIONAL