VB icon

AutoComplete Made EASY!

Email
Submitted on: 1/9/2015 5:13:00 AM
By: Justin Stevens (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages)
Views: 679
 
     This small script simply and easly creates an AutoComplete affect for your ComboBox. VERY EFFECTIVE AND VERY EASY TO UNDERSTAND.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: AutoComplete Made EASY!
' Description:This small script simply and easly creates an AutoComplete affect for your ComboBox. VERY EFFECTIVE AND VERY EASY TO UNDERSTAND.
' By: Justin Stevens (from psc cd)
'
' Returns:The code returns the text that the use inputs into the combo box followed by the AutoCompleted text which is highlighted. 
EG)
The user types "F"
The ComboBox then Displays a normal "F" which is then followed by "rog" which is highlighted to give "Frog" where "rog" is the .seltext. Understand?
NOTE: This is not hard to explain, sorry if you do not get what I am saying :)
'
' Assumes:This code can be further inhanced by using
If Ucase(.text) = Ucase(......
I will leave the rest for you to discover and learn, but I think you will agree that this code is very promising, flawless and alot less complicated then all the other AutoCompleters!
'**************************************

Private Sub ComboBox_KeyPress(KeyAscii As Integer)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
On Error GoTo Oops
With ComboBox
Kounter = 0
For Kounter = 0 To .ListCount
If .Text = Left(.List(Kounter), Len(.Text)) Then
OldLength = Len(.Text)
.Text = .List(Kounter)
.SelStart = OldLength
.SelLength = Len(.Text) - OldLength
Timer1.Enabled = False
GoTo Oops
End If
Next Kounter
End With
Oops:
Timer1.Enabled = False
End Sub


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.