Difference between revisions of "PAV I VB"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Nfesette
imported>Jholden
Line 3: Line 3:
 
Button click handler:
 
Button click handler:
  
<code type=vb.net>
+
<code type=vbnet>
 
Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
 
Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
  

Revision as of 10:34, 16 April 2015

PAV-I will be discontinued in March 2013. We sincerely appreciate your support and regret any inconvenience this may cause.

Button click handler:

Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click

Dim service As PavInternationalServiceClient = New PavInternationalServiceClient("paviws") Dim request As New AddressInternationalRequest()

'Check each textbox and add corresponding field if the textbox is not empty Dim availableFields As New List(Of KeyValue)()

availableFields.Add(New KeyValue() With {.Key = "ORGANISATION", .Value = ""}) availableFields.Add(New KeyValue() With {.Key = "SUBBUILDING", .Value = ""}) availableFields.Add(New KeyValue() With {.Key = "BUILDINGNAME", .Value = "Rose House"}) availableFields.Add(New KeyValue() With {.Key = "BUILDINGNUMBER", .Value = "51-59"}) availableFields.Add(New KeyValue() With {.Key = "DEPSTREET", .Value = ""}) availableFields.Add(New KeyValue() With {.Key = "STREET", .Value = "Circular Road"}) availableFields.Add(New KeyValue() With {.Key = "DEPLOCALITY", .Value = ""}) availableFields.Add(New KeyValue() With {.Key = "LOCALITY", .Value = ""}) availableFields.Add(New KeyValue() With {.Key = "POSTTOWN", .Value = ""}) availableFields.Add(New KeyValue() With {.Key = "COUNTY", .Value = ""}) availableFields.Add(New KeyValue() With {.Key = "POSTCODE", .Value = "IM1 1AZ"}) availableFields.Add(New KeyValue() With {.Key = "ADDR", .Value = "United Kingom"}) 'You may place the country or entire address in this parameter

'Check what output fields are required on return Dim returnFields As New List(Of String)()

returnFields.Add("RESCODE") returnFields.Add("OUTPUTSTATUS") returnFields.Add("MATCHLVL") returnFields.Add("ADDR") returnFields.Add("ORGANISATION") returnFields.Add("BUILDINGNUMBER") returnFields.Add("BUILDINGNAME") returnFields.Add("SUBBUILDING") returnFields.Add("STREET") returnFields.Add("DEPSTREET") returnFields.Add("LOCALITY") returnFields.Add("DEPLOCALITY") returnFields.Add("POSTTOWN") returnFields.Add("COUNTY") returnFields.Add("POSTCODE") returnFields.Add("COUNTRY") returnFields.Add("COUNTRYCODE")

'Convert to array and add to the request request.AddressFields = availableFields.ToArray() request.ReturnFields = returnFields.ToArray()

'Set License key request.LicenseKey = "YOUR LICENSE KEY"

'Check if native output is requested request.ReturnNativeOutput = (chkNATIVE.Checked = True)

'Call the service Dim response As AddressInternationalResponse = service.VerifyAddressInternational(request) response = service.VerifyAddressInternational(request)

'Update UI with the results - in this example the results returned to a GridView gridview1.DataSource = response.AddressFields gridview1.DataBind() gridview1.AutoGenerateColumns = True