February 28, 2021
Hot Topics:

The Secret of Soundex

  • By Karl Moore
  • Send Email »
  • More Articles »

To test out the code, let's quickly knock together a sample project.

  • Launch Visual Basic
  • Create a new Standard EXE project
  • Paste the Soundex algorithm behind Form1

This simple project will take the values from two Text Boxes, compare them and state whether or not their Soundex codes match.

  • Add two Text Boxes, a Command Button and a Label to your Form, positioning them a little like this:

Ignore regular naming conventions for now. Go on, I dare you. Hey, you've got to have a bit of fun! We're young, innocent...

  • Add this code behind your Command Button:
Private Sub Command1_Click()    Text1.Tag = Soundex(Text1.Text)    Text2.Tag = Soundex(Text2.Text)        If Text1.Tag = Text2.Tag Then        Label1.ForeColor = vbRed - 100        Label1.Caption = "The Soundex codes match!"    Else        Label1.ForeColor = vbBlue        Label1.Caption = "The Soundex codes don't match"    End IfEnd Sub

That's it! You've created your simple test application.

  • Press F5 to run

To test the project, enter two values such as 'JON' and 'JOHN' and hit the Command Button. You might also want to experiment with:

  • Visual, Vezual
  • Richard, Ricardo
  • Forrest, Forest, Forrester
  • Checker, Chequer
  • Sideroad, Syde-rowd
  • Coronation, Carnation

Page 5 of 6

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date