Perform Look-Ahead Typing

Perform Look-Ahead Typing

This subroutine lets the user perform look-ahead typing, as in Netscape Navigator, Microsoft Internet Explorer, and other apps. The sub takes an array of strings and a TextBox control as parameters. You can easily change the subroutine to accept a ListBox control instead of an array of strings. You can call this sub from the TextBox’s KeyUp event:

 Public Sub DoLookAhead(strArray() As String, ctlText _	As TextBox)	Dim strText As String	Dim strLength As Integer	Dim x As Integer	strText = LCase$(ctlText.Text)	strLength = Len(strText)	If strLength > 0 Then		For x = LBound(strArray) To UBound(strArray)		If strText = LCase$(Left$(strArray(x), strLength)) _			Then			'we found something			If Len(strArray(x)) > strLength Then				ctlText.Text = ctlText.Text + _					Mid$(strArray(x), strLength + 1)				ctlText.SelStart = strLength				ctlText.SelLength = Len(strArray(x)) - _					strLength			End If			Exit For		End If		Next	End IfEnd Sub
See also  Small Business Strategies with Venmo

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist