-We should only be able to enter ISBN's in this format, 0-1234567-8-9 or 0-1234567-8-X.
-What I have now automatically inserts hyphens at a certain text length but doesn't let me delete the hyphens that have been added (besides the last one)
-So how would I be to delete the hyphens? I think I have to delete two characters (one character being a hyphen) at once in order to remove the hyphen.
-Also, how do I allow a number or an "x" to be added to the 13 position in the string?
Private Sub txtISBN_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtISBN.KeyPress
If txtISBN.TextLength = 1 Then
txtISBN.Text = txtISBN.Text + "-"
txtISBN.SelectionStart = Len(txtISBN.Text)
Else
If txtISBN.TextLength = 9 Then
txtISBN.Text = txtISBN.Text + "-"
txtISBN.SelectionStart = Len(txtISBN.Text)
Else
If txtISBN.TextLength = 11 Then
txtISBN.Text = txtISBN.Text + "-"
txtISBN.SelectionStart = Len(txtISBN.Text)
End If
End If
End If
End Sub