开发者

Visual basic 6 textbox autocomplete feature?

开发者 https://www.devze.com 2022-12-07 23:41 出处:网络
How can i add an autocomplete feature in a textbox? As soon as i write something in a 开发者_JAVA百科textbox(whether 1 character or 2 or 3), it should match it with the student name in the database an

How can i add an autocomplete feature in a textbox? As soon as i write something in a 开发者_JAVA百科textbox(whether 1 character or 2 or 3), it should match it with the student name in the database and complete the name.


For a hardcore solution, here's a free ComboBox control with autocomplete, implemented from scratch in VB6 from Steve McMahon's excellent vbAccelerator.com.


You could trap the keypress event and make the database call there. If you wanted a minimum of 2 or 3 characters before making the DB call to reduce the number of rows coming back just check the length of the text in the textbox before making the call.


On Key Up event you can get the value from the text box and choose the list of "related or similar" values from DB and then change the value of the textbox with the first value from the result from DB and repeat the above steps for every letter entered.

Here is an Auto Complete code sample for Combo box which is worth checking.


there is no auto complete in a textbox of visual basic 6, then you must to create it from 0, here is a sample of that.

http://www.recursosvisualbasic.com.ar/htm/trucos-codigofuente-visual-basic/6.htm

0

精彩评论

暂无评论...
验证码 换一张
取 消