Public Class MyTb Enum ETFormat TimeHHMM = 1 Normal = 0 End Enum Private v_TextFormat As ETFormat = ETFormat.Normal Property TextFormat() As ETFormat Get Return v_TextFormat End Get Set(ByVal value As ETFormat) Me.v_TextFormat = value End Set End Property Dim NC As Control = Nothing Private Sub MyTb_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus Me.SelectAll() End Sub Private Sub MyTb_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If e.KeyCode = Keys.Enter Then If Me.Text <> "" Then Dim Txt As String = Me.Text Select Case TextFormat Case ETFormat.Normal Case ETFormat.TimeHHMM If Txt.IndexOf(":") = -1 Then If IsNumeric(Txt) Then Select Case Txt.Length Case 1 Me.Text = "0" & Txt & ":00" Case 2 Me.Text = Txt & ":00" Case 3 Me.Text = Txt.Substring(0, 2) & ":" & Txt.Substring(2) & "0" Case 4 Me.Text = Txt.Substring(0, 2) & ":" & Txt.Substring(2) End Select End If End If End Select End If If Me.NC Is Nothing Then SendKeys.Send("{TAB}") Else NC.Focus() End If End If End Sub Public Property NectControl() As Control Get Return NC End Get Set(ByVal value As Control) NC = value End Set End Property End Class