Getting Full address finder using the .Net Assembly
Full Address Search functionality:
- User enters postcode
- Postcode Software displays a list of addresses
- Address is selected by user.
- Full address returned to user within software
When using the .Net Assembly, to search by Postcode to get Full address, we have two choices of implementation:
- Using the .Net Assembly UI, for fast and easy implementation (including advanced word search)
- Use .Net Assembly to retrieve address data, but implement your own user interface
Note: the .Net Assembly is for desktop applications compiled to 32 bits. It will run fine on 64 bit machines, but will not support an application compiled to 64 bits, as it uses Microsoft MDAC which does not support 64 bits.
Getting Full address using the .Net Assembly User Interface
Step 1 Sign up for 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 .Net Assembly
The .NET Assembly is for use with any Desktop .NET project. 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 .NET Assembly is in the “NET Assembly” directory of our api example code.
Note: the .Net Assembly is for 32bit desktop applications
How to distribute .NET Assembly
Simply include the “ISimplyPostCodeClass.dll” in your application directory.
Step 3 Creating the .NET Assembly
Copy the “ISimplyPostCodeClass.dll” in your application directory, and then add it to your project references. This can be found in the “NET Assembly” directory of our example code.
In C# or VB, simply right click on the project in the Solution Explorer. Select “Add Reference”. On the window that opens, click on the Browser tab. Now find and double click on “ISimplyPostCodeClass.dll” to add reference.
The class constructor takes a parameter of a working directory PATH. This directory is used to store the advanced search data used in combos if used. This must be a valid directory, and have WRITE permissions.
VB.Net |
Public Class Form1 |
C# .NET |
public partial class Form1 :
Form |
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_".
VB.Net |
SimplyPostCodeLookup.SetDataKey(Me.txtDataKey.Text) |
C# .NET |
string DataKey="Your Data
Key"; |
Optional, set Proxy sever details
A function allows the program to define the proxy settings touse when requesting data from our internet server.
Simply call SetProxy(ProxyAddress, usedID, Password, Domain)
Parameters
Parameter name | Description |
---|---|
ProxyAddress As String | For example "http://proxy:80/" |
usedID As String | Username to log in to proxy |
Password As String | Password to log in to proxy |
Domain As String | Domain of proxy |
VB.Net |
'Set Proxy Server |
C# .NET |
'Set Proxy Server |
Step 5 Call SearchForFullAddressWithDialogue to Present List of addresses at Postcode
Simply call SearchForFullAddressWithDialogue(PostcodePrima, Caption, ShowLicienceDetails, AllowManageAccount, DisplayErrors)
This call can be used with Local Data or Internet based data.
This function call will display a dialogue box for the
user to enter the postcode to search for, or address words
if using Advanced Search (Web Based data only). 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.
Postcode Lookup Example:
This code displays the following Postcode Address Lookup window:
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 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.
Postcode Software Full Address - Example Code
Simply download the example code. The code is in the "NET assembly/Csharp NET Assembly Example" or "NET assembly/VB NET Assembly Example" directory of our example downloads.
These two examples demonstrate postcode lookup software using Full Address.
Full Address using the .NET Assembly and implement your own User Interface:
This is a two-step process. First we present a list to the user, then wait for user selection. After selection we retrieve the full address from the database.
Follow steps 1-4 above.
Step 5 Sign up for 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 6 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 7 Call for each line to display
And then call GetFullAddressLineForSelection() to get each line for list selection for display, discussed in next section.
Example Full Address 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 8 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 9 Testing
Final step is to test, to enable easy testing please use our special test postcodes.
Postcode Software - Example Code
Simply download the example code. The code is in the "NET assembly/Csharp NET Assembly Example" or "NET assembly/VB NET Assembly Example" directory of our example downloads.
These two examples demonstrate postcode lookup software using Full Address.
Alternative using Address ID:
In the previous two steps we used the NET assembly to remember, in the background, the actual address record IDs used to get the resultant address record. This makes implementing for traditional desktop software easier.
When implementing for a web site we need to store the actual address ID’s in the combo box we allow the user to select from since we cannot keep the state of the NET Assembly alive between calls from the users web page. Indeed the SimplyPostCodeLookup object life is only the duration of the address query.
Follow steps 1-4 above.
Step 5 Present a list fo addreses from postcode entered
To obtain the Address ID and the line information, we use:
.GetFullAddressLineForSelectionWithID(ID as string)
Instead of .GetFullAddressLineForSelection()
Example code to get list:
VB.Net |
Dim SimplyPostCodeLookup = New ISimplyPostCodeClass.ISimplyPostCodeClass(CurDir) 'Set Data key, to identify your account 'If using Local Mode data files then the following code sets the PATH. Dim PostCode$ = "PE13 2QL"; With SimplyPostCodeLookup If .GetFullAddressToList(PostCode$) Then 'Now Populate the List box Do Until Line = "" Me.ListAddresses.Items.Add(New ListItem(Line, ID)) If Me.ListAddresses.Items.Count = 0 Then Me.Label1.Text = "Nothing found..." Me.Label2.Text = "Simply Postcode Lookup : " & .General_credits_display_text SimplyPostCodeLookup = Nothing
|
Step 6 Get Address Reord Selected
Then we need to get the Address record, when user double clicks on address line in selection box.
This time we call GetFullAddressRecordByAddressID(addressID as string)
Parameters
Parameter name | Description |
---|---|
addressID as string | The Address ID is returned in this string |
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 code to get address
VB.Net |
Dim addressID$ = "11570840_0E" Dim SimplyPostCodeLookup = New ISimplyPostCodeClass.ISimplyPostCodeClass(CurDir) 'If using Local Mode data files then the following code sets the PATH Dim DataToDisplay$ = "" With SimplyPostCodeLookup DataToDisplay += "Simply Postcode Lookup : " & .General_credits_display_text SimplyPostCodeLookup = Nothing |
Step 7 Testing your Address Search Software
Final step is to test, to enable easy testing please use our special test postcodes.
Postcode Software Advanced Search - Example Code
Simply download the example code. The code is in the "NET assembly/Csharp NET Assembly Example" or "NET assembly/VB NET Assembly Example" directory of our example downloads.
These two examples demonstrate postcode lookup software using Full Address.
Data Returned:
This type of license returns: (see example below)
Public Address_Id As String ●
Public Address_Organisation As String
Public Address_Line1 As String
Public Address_Line2 As String
Public Address_Line3 As String
Public Address_Town As String
Public Address_County As String
Public Address_Postcode As String
Public Address_Country As String
'Note: When using getting Thoroughfare only:
'Address_Organisation is Not returned
'Address_Line1 may return road name, but the user must supply the Building
'Name/Number in your software, so you will need to prompt them for this data
'Extra Address information contained in PAF data file
Public Address_Deliverypointsuffix As String ●
Public Address_NoHouseHolds As String ●
Public Address_Smallorg As String ●
Public Address_PoBox As String ●
Public Address_Rawpostcode As String ●
Public Address_Mailsort As String ●
Public Address_Unique As String ● *
Public Address_UDPRN As String ● *
Public Address_Spare As String ● *
* = Not available in Local Mode
● see Additional Data Returned by Postcode Finder API for more information