RecogniContact/COM - International Address Parser - Visual Basic Sample Code (RecogniContact address parser)
Overview
Using RecogniContact
Deploying RecogniContact
Class IContactParser
Class IParsedContact
Class IParserSettings
Sample code for C#
Sample code for C++
Sample code for Delphi
Sample code for Visual Basic (win32)
Sample code for Visual Basic .NET

Sample code for using RecogniContact/COM address parser in Visual Basic (Win32)

NOTE!
- Make sure to first add RecogniContact.dll to project references as decribed here
- Replace [YOUR NAME] and [YOUR LICENSE KEY] with your license details
- In the main application using RecogniContact.dll, set the maximum stack size to at least 2 megabytes.
(In Microsoft Visual Studio, go to Project - Properties - Configuration Properties - Linker - System and set "Stack Reserve Size" to "2000000".)


        
Private Sub RecogniContactDemo()

Dim parser As New RecogniContact.parser
Dim parsedContact As RecogniContact.IParsedContact
Dim parserSettings As RecogniContact.IParserSettings

'Address parser initialization
'-----------------------------
  parser.Initialize "[YOUR NAME]", "[YOUR LICENSE KEY]"
        

'get the address parser settings object
'--------------------------------------
  Set parserSettings = parser.CreateSettingsObject()

'modify the address parser settings object
'-----------------------------------------
  parserSettings.TranslateExistingCountryNames = True
  parserSettings.CountryNameLanguage = RecogniContact.Language_EN

  parserSettings.StandardizePhoneNumberFormat = True
  parserSettings.InternationalPhoneNumber_IntlAccessCode = '+'
  parserSettings.InternationalPhonePrefixFormat = "_(123)_"
  
  parserSettings.MakeAllPhoneNumbersInternational = True
  parserSettings.MakeAllPhoneNumbersInternational_DefaultCountry = RecogniContact.Country_US

'activate the new address parser settings
'----------------------------------------
  parser.Settings parserSettings

'do the address parsing 
'----------------------
  Set parsedContact = parser.Parse("Dr. Walter W. Wagoner - Exhibition Manager" + Chr(13) + Chr(10)+
                                   "The Museum of Modern Art" + Chr(13) + Chr(10)+
                                   "Address: 11 West 53 Street, New York, NY 10019" + Chr(13) + Chr(10)+
                                   "Phone:   (212) 708-9400" + Chr(13) + Chr(10)+
                                   "Email:   info@moma.org" + Chr(13) + Chr(10)+
                                   "Web:     www.moma.org");
                                   
'now use
'        parsedContact.GetValue()
'to access the parsed values

'show the Parsed Country 
  MsgBox ("Country = " + parsedContact.GetValue(ContactFieldType_Country))


'Call GetValue() with the following arguments:
'      ContactFieldType_Prefix
'      ContactFieldType_FirstName
'      ContactFieldType_MiddleName
'      ContactFieldType_LastName
'      ContactFieldType_Suffix
'      ContactFieldType_Company
'      ContactFieldType_Company2
'      ContactFieldType_Position
'      ContactFieldType_StreetAddress1
'      ContactFieldType_StreetAddress2
'      ContactFieldType_PostboxAddress
'      ContactFieldType_PostboxPostCode
'      ContactFieldType_PostCode
'      ContactFieldType_PlaceName
'      ContactFieldType_Province
'      ContactFieldType_Country
'      ContactFieldType_Phone1
'      ContactFieldType_Phone2
'      ContactFieldType_Mobile
'      ContactFieldType_Fax
'      ContactFieldType_Email
'      ContactFieldType_Url
'      ContactFieldType_Gender
'      ContactFieldType_CountryIsoCode}

End Sub