Quick Search for:  in language:    
high,class,code,article,never,stingy,with,lov
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,029,109. lines
 Jobs: 121. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Winsock with the boy
By Daniel Callander on 7/9


Click here to see a screenshot of this code!__AA Hack Keys
By JAKI on 7/9

(Screen Shot)

RSH from VBScript - execute command on UNIX or LINUX
By Roby Kott on 7/9


VBScript samples
By Roby Kott on 7/9


DBA tools
By Roby Kott on 7/9


Monitoring Tools
By Roby Kott on 7/9


Monitor Tools
By Roby Kott on 7/9


Make Path / Create Dir
By Dream on 7/9


Venus MUD Server
By Andrew Armstrong on 7/9


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Advanced Auto Complete List Combo and List Boxs

Print
Email
 

Submitted on: 6/25/2003 7:16:54 PM
By: Said Sowiny 
Level: Advanced
User Rating: By 3 Users
Compatibility:VB 5.0, VB 6.0

Users have accessed this article 1321 times.
 
(About the author)
 
     This is a high class code article . i never be stingy with vb lovers . I try and success to move the power of access to the power of vb . The main features are : 1) the sub can be used with combo box and list box controls. 2) High performance. 3) faster with huge lists. 4) fully support of Delete and Backspace keys. 5)Case Sensitive. 6) of course few lines of code point to the purpose. Try it and tell me. If you found this really advanced please be faithful and tender and vote. Thanks.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.

'==================================

Public Sub AutoCompleteList(ByVal cboCtl As ComboBox, ByVal KeyCode As Integer)

'No comments it is clear .

Dim Counter As Integer

Dim Length As Integer

If cboCtl <> "" Then

If KeyCode = vbKeyBack Or KeyCode = vbKeyDelete Then

KeyCode = 0

Exit Sub

End If

For Counter = 0 To cboCtl.ListCount - 1

Length = Len(cboCtl.Text)

If Mid(cboCtl.List(Counter), 1, Len(cboCtl)) = cboCtl.Text Then

cboCtl.Text = cboCtl.List(Counter)

cboCtl.SelStart = Length

cboCtl.SelLength = Len(cboCtl.Text)

cboCtl.ListIndex = Counter

Exit For

End If

Next

End If

End Sub

'===========================================

Typical usage :

Private Sub cboCategory_Change()

Call AutoCompleteList(cboCategory, mintKeyCode)

End Sub

Where mintKeyCode is a form variable given by a Form_KeyDown event like :

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

mintKeyCode = KeyCode

End Sub

and the cboCategory is the combo box filled by your own items.

Taking into consideration the header of the form should look like this one :

Option Explicit

Private mintKeyCode As Integer

and your form KeyPreview Property is set to TRUE.

Enjoy ,


Other 5 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
6/26/2003 5:15:03 AM:Masino Sinaga
It's very useful. I like it. 5 globes from me.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/26/2003 6:10:07 AM:Daniel W. Elkins
Good work, nice routine. Keep it up. :) 5 from me.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.