Letters To Numbers Sample Code Snippet

TeleTools

This sample code snippet demonstrates how to convert the letters on a phone keypad to the numbers that correspond to them.  For example, 

1-800-Get New Info would translate to... '

1-800-438-639-4636.

Requirements

The Delphi version is just a snippet with instructions on how to use it.  The VB snippet has a project for you to download.

VB Code Snippet
Delphi Code Snippet

Development Environment Technical Information
Telephony Hardware Technical Information

How To Use This Code Snippet - VB

This VB code snippet shows how to create a function that will automatically convert phone number with alphabetic (letters) characters in the name.  A simple form with 2 text boxes, one to hold the number you wish to convert, a second to hold the converted number, and a Command button to execute the function

How To Use This Code Snippet - Delphi

The Delphi example is a clever way to modify the actual editbox that you are typing in.  As you type a number with letters, it is automatically converted and displayed.  In other words, we aren't using a "enter your text here" box and then displaying it in a "result" box.  We turn off the Notify event for the SharedPhoneNumberChange editbox and then move the cursor along the text path changing any letters to their corresponding dialpad number.

To compile this in a simple sample application, just add an editbox control to a form, name it "SharedEditPhoneNumber" and double click on it.  Then just copy and paste the code below into the SharedEditPhoneNumberChange procedure it creates.  When you run the program, type in a phone number like 1-800-Buy-TeleTools and watch what happens.

Release Notes

April 30, 2003

Published