Postcode Programming API  Thoroughfare/Street address using COM Object


Thoroughfare/Street Address Search functionality:

  • Postcode is entered in software by user, to search for
  • Address returned apart from House Name and Number
  • User enters House Name and Number manually, unlike Full Address

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 GetThoroughfareAddressRecord to get address from postcode

Simply call GetThoroughfareAddressRecord(Postcode) as Boolean

This type of search will get most of the address, except the house name or number. The user then must enter this information themselves.

  This call can be used with Local Data or Internet based data. 

Simply call with the postcode to search for.

Parameters

Parameter nameDescription
Postcode as stringPostcode to find.

Returns

Returns true if address search completed and General_credits_display_text contains summary of Credits/License status. Else errors reported in General_errormessage.

Postcode Lookup Example:

This code gets the Thoroughfare/Street address information from the Royal Mail address database.

  VB6

With SimplyPostCodeLookup
   PostcodeToSearchFor = "PE13 2QL"
   If .GetThoroughfareAddressRecord(PostcodeToSearchFor) Then
      ‘Process data
      me.Line1 = .Address_line1
      me.Line2 = .Address_line2
   Else
      'Show/Handle any errors
      MsgBox .General_credits_display_text & vbCrLf & .General_errormessage,
                        vbCritical,"Simply Postcode Lookup"

   End If

   'Show Credit/License in form caption
   Me.Caption = .General_credits_display_text
End With


  VB.Net
 

'Set Data key, to identify your account
SimplyPostCodeLookup.SetDataKey("Your Data Key")

With SimplyPostCodeLookup

   If .GetThoroughfareAddressRecord(Me.txtPostcode.Text) Then
      Me.Line1.text = .Address_Line1
      Me.Line2.text = .Address_Line2
      Me.Line3.text = .Address_Line3
      Me.Town.text = .Address_Town
      Me.County.text = .Address_County
      Me.Postcode.text = .Address_Postcode

   Else
      If .General_errormessage <> "" Then
         MsgBox(.General_credits_display_text & vbCrLf & .General_errormessage,
                  vbCritical, "Simply Postcode Lookup")

      Else
         MsgBox("Not found!")
      End If
   End If

   Me.Text = "Simply Postcode Lookup : " & .General_credits_display_text
End With


  C# .NET

//Set Data key, to identify your account
string DataKey= "Your Data Key";
string DataToShow= "";
string string crlf = "\r\n";

SimplyPostCodeLookup.SetDataKey(DataKey);

string PostCodeToFind=txtPostcode.Text;
if (SimplyPostCodeLookup.GetThoroughfareAddressRecord(PostCodeToFind) == true)
{
   MessageBox.Show(GetReturnedAddressDataToText( ), "Simply Postcode Lookup");

   DataToShow = " line1 : " + SimplyPostCodeLookup.Address_Line1 + crlf;
   DataToShow = DataToShow + " line2 : " + SimplyPostCodeLookup.Address_Line2 + crlf;
   DataToShow = DataToShow + " line3 : " + SimplyPostCodeLookup.Address_Line3 + crlf;
   DataToShow = DataToShow + " town : " + SimplyPostCodeLookup.Address_Town + crlf;
   DataToShow = DataToShow + " county : " + SimplyPostCodeLookup.Address_County + crlf;
   DataToShow = DataToShow + " postcode : " + SimplyPostCodeLookup.Address_Postcode + crlf;

   //If low credit then can display button to buy more Credits/Licenses
   //This is optional, but it is recommended to provide some means for the end
   //Customer to purchase new Credits/Licenses from Simply Postcode Lookup Direct
   if (SimplyPostCodeLookup.General_credits_display_showbutton==true)
   {
      ButtonBuyMore.Visible = true;
   } else {
      ButtonBuyMore.Visible = false;
   }
} else {
   if (SimplyPostCodeLookup.General_errormessage != "" )
   {
      MessageBox.Show(SimplyPostCodeLookup.General_credits_display_text+" "+
      SimplyPostCodeLookup.General_errormessage, "Simply Postcode Lookup");

   } else {
      MessageBox.Show("Not found!");
   }
}

this.Text = "Simply Postcode Lookup : " + SimplyPostCodeLookup.General_credits_display_text;

Step 4 Testing

Final step is to test, to enable easy testing please use our special test postcodes.

Postcode Software - COM 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 Thoroughfare/Street Address unsing the COM object.


Data Returned:


This type of license returns: (see example below)

  • Street Name
  • Locality
  • Town
  • County
  • Postcode
  • Country "England","Wales","Northern Ireland","Isle of Man","Channel Islands","Scotland"
  • Mail sort Code