RecogniContact/COM - International Address Parser - Visual C# 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 C#

NOTE!
- Make sure to first add RecogniContact.dll to the project references as decribed here
- Replace [YOUR NAME] and [YOUR LICENSE KEY] with your license details


        
private void demobutton_Click(object sender, EventArgs e)
{
    RecogniContact.Parser parser = new RecogniContact.Parser();
    RecogniContact.IParsedContact parsedContact;
    RecogniContact.IParserSettings parserSettings;

    //Address parser initialization
    //-----------------------------
    parser.Initialize("[YOUR NAME]", "[YOUR LICENSE KEY]");

    //create an address parser settings object
    //-----------------------------------------
    parserSettings = parser.CreateSettingsObject();

    //modify the address parser settings object
    //-----------------------------------------
    parserSettings.TranslateExistingCountryNames = true;
    parserSettings.CountryNameLanguage = RecogniContact.Language.Language_EN;

    parserSettings.StandardizePhoneNumberFormat = true;
    parserSettings.InternationalPhoneNumber_IntlAccessCode = "+";
    parserSettings.InternationalPhonePrefixFormat = "_(123)_";

    parserSettings.MakeAllPhoneNumbersInternational = true;
    parserSettings.MakeAllPhoneNumbersInternational_DefaultCountry = RecogniContact.Country.Country_US;

    //activate the new address parser settings
    //----------------------------------------
    parser.Settings(parserSettings);

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

    //show the country 
    MessageBox.Show ("Country = " +
                     parsedContact.GetValue(RecogniContact.ContactFieldType.ContactFieldType_Country));

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




}