VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



AutoComplete Made EASY

by Justin Stevens (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

This small script simply and easly creates an AutoComplete affect for your ComboBox. VERY EFFECTIVE AND VERY EASY TO UNDERSTAND.

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!
Code 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 :)

Rate AutoComplete Made EASY

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

Download this snippet    Add to My Saved Code

AutoComplete Made EASY Comments

No comments have been posted about AutoComplete Made EASY. Why not be the first to post a comment about AutoComplete Made EASY.

Post your comment

Subject:
Message:
0/1000 characters