mieuhoa > 15-11-15, 07:53 PM
mieuhoa > 16-11-15, 11:08 PM
ongke0711 > 16-11-15, 11:28 PM
Private Sub txtSoDT_KeyUp(KeyCode As Integer, Shift As Integer)
Dim vitri As Variant
Dim str As String, strGoc As String
vitri = Array(Me.txtSoDT.SelStart, Me.txtSoDT.SelLength)
Me.txtEmail.SetFocus 'Di chuyen qua field khac de luu du lieu cua textbox so dien thoai
Me.txtSoDT.SetFocus
'Tra con tro ve vi tri cu
Me.txtSoDT.SelStart = vitri(0)
Me.txtSoDT.SelLength = vitri(1)
If KeyCode <> vbKeyBack Or KeyCode <> vbKeyDelete Then
If Len(Me.txtSoDT) > 6 Then
strGoc = Replace(Me.txtSoDT, "-", "")
str = Left(strGoc, Len(strGoc) - 6) & "-" & Left(Right(strGoc, 6), 3) & "-" & Right(strGoc, 3)
Me.txtSoDT = str
Me.txtSoDT.SelStart = vitri(0) + 2 'Len(Me.txtSoDT)
Me.txtSoDT.SelLength = vitri(1) + 2 'Len(Me.txtSoDT)
End If
End If
End Sub
mieuhoa > 17-11-15, 12:16 AM