dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Mar 26, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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 If
End Sub
Robert Gelb
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date