AutoTabThis is a featured page

Public Sub AutoTab()
'For TextBoxes with MaxLength property > 0.
'Tabs only if the cursor is at the end of the text.
'Sub Text1_Change ()
' Call AutoTab
'End Sub
Dim Text1 As Control
Dim Text As String
Dim Length As Integer
Dim MaxLen As Integer

On Error GoTo AutoTabTrap
Set Text1 = Screen.ActiveControl
Text = Text1.Text
Length = Len(Text)
MaxLen = Text1.MaxLength
If Length > MaxLen Then
'How can this be? Maybe it was pasted.
'This causes another change event so we'll be back.
Text1.Text = Left$(Text, MaxLen)
ElseIf Length = MaxLen And Text1.SelStart = MaxLen Then
SendKeys "{TAB}"
End If
AutoTabTrap:
Exit Sub
End Sub


No user avatar
2buck
Latest page update: made by 2buck , Dec 1 2006, 11:42 PM EST (about this update About This Update 2buck Edited by 2buck


view changes

- complete history)
Keyword tags: VB 6 (edit keyword tags)
More Info: links to this page

Anonymous  (Get credit for your thread)


There are no threads for this page.  Be the first to start a new thread.

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)