To add to what Richard suggests, the formatting itself isn't complicated:
private string ToISBNFormat(string s)
{
StringBuilder result = new StringBuilder(13 + 4);
s = Regex.Replace(s, "-", "");
int len = s.Length;
if (len < 3) return s;
result.AppendFormat("{0}-", s.Substring(0, 3));
len -= 3;
if (len >= 1) result.AppendFormat("{0}-", s[3]);
len -= 1;
if (len > 0) result.AppendFormat("{0}-", s.Substring(4, Math.Min(2, len)));
len -= 2;
if (len > 0) result.AppendFormat("{0}-", s.Substring(6, Math.Min(6, len)));
len -= 6;
if (len > 0) result.Append(s.Substring(12, Math.Min(1, len)));
return result.ToString();
}
You may also need to work on the cursor position: you can get and set it via the TextBox.SelectionStart property