'AC=Area Code
'X=Extension
'P=Last 4 digits of phone
Private Sub PhoneTextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AC1.TextChanged, AC2.TextChanged, AC3.TextChanged, X1.TextChanged, X2.TextChanged, X3.TextChanged, P1.TextChanged, P2.TextChanged, P3.TextChanged, P4.TextChanged
Select Case sender.name
Case "AC1"
AC2.Focus()
Case "AC2"
AC3.Focus()
Case "AC3"
X1.Focus()
Case "X1"
X2.Focus()
Case "X2"
X3.Focus()
Case "X3"
P1.Focus()
Case "P1"
P2.Focus()
Case "P2"
P3.Focus()
Case "P3"
P4.Focus()
Case "P4"
PC1.Focus()
End Select
End Sub 'PhoneTextChanged
Private Sub PhoneEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles AC1.Enter, AC2.Enter, AC3.Enter, X1.Enter, X2.Enter, X3.Enter, P1.Enter, P2.Enter, P3.Enter, P4.Enter
Select Case sender.name
Case "AC1"
AC1.SelectAll()
Case "AC2"
AC2.SelectAll()
Case "AC3"
AC3.SelectAll()
Case "X1"
X1.SelectAll()
Case "X2"
X2.SelectAll()
Case "X3"
X3.SelectAll()
Case "P1"
P1.SelectAll()
Case "P2"
P2.SelectAll()
Case "P3"
P3.SelectAll()
Case "P4"
P4.SelectAll()
End Select
End Sub 'PhoneEnter
Private Sub PhoneMouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles AC1.MouseUp, AC2.MouseUp, AC3.MouseUp, X1.MouseUp, X2.MouseUp, X3.MouseUp, P1.MouseUp, P2.MouseUp, P3.MouseUp, P4.MouseUp
Select Case sender.name
Case "AC1"
AC1.SelectAll()
Case "AC2"
AC2.SelectAll()
Case "AC3"
AC3.SelectAll()
Case "X1"
X1.SelectAll()
Case "X2"
X2.SelectAll()
Case "X3"
X3.SelectAll()
Case "P1"
P1.SelectAll()
Case "P2"
P2.SelectAll()
Case "P3"
P3.SelectAll()
Case "P4"
P4.SelectAll()
End Select
End Sub 'Phone_MouseUp
Private Sub PhoneLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles AC1.Leave, AC2.Leave, AC3.Leave, X1.Leave, X2.Leave, X3.Leave, P1.Leave, P2.Leave, P3.Leave, P4.Leave
If Len(sender.text) > 1 Then
MessageBox.Show("You can only have 1 number in this box.", "Information Systems", MessageBoxButtons.OK, MessageBoxIcon.Information)
sender.focus()
sender.SelectAll()
End If
End Sub 'PhoneLeave
Private Sub PhoneKeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles AC1.KeyUp, AC2.KeyUp, AC3.KeyUp, X1.KeyUp, X2.KeyUp, X3.KeyUp, P1.KeyUp, P2.KeyUp, P3.KeyUp, P4.KeyUp
Select Case e.KeyCode
Case Keys.Enter
Select Case sender.name
Case "AC1"
AC2.Focus()
Case "AC2"
AC3.Focus()
Case "AC3"
X1.Focus()
Case "X1"
X2.Focus()
Case "X2"
X3.Focus()
Case "X3"
P1.Focus()
Case "P1"
P2.Focus()
Case "P2"
P3.Focus()
Case "P3"
P4.Focus()
Case "P4"
PC1.Focus()
End Select
End Select
End Sub
'PC1 is the next text box after the phone number.