Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editable Combo box.

Status
Not open for further replies.

AFK1

IS-IT--Management
Aug 26, 2005
38
US
Can someone help on how can I make a combo box editable. I am trying to create a combo box and I want that when user types, the combo box should automatically go to the letters typed by user and show him itms that has those letters. I know how to do this in vb.Net, but I don't know what kind of combox to use and how to accomplish this task.
 
Use the combobox control, set the style property to dropdown combo.

As for the rest, use the List property, which is an array of strings. Handle the keystrokes in the KeyPress event.

Should be pretty similar logic to the .Net. The main difference is that the content of the box isn't expressed in terms of a collection of objects, as it is in .Net, but as an array of strings. There's also an ItemData property, which is an integer associated with each list item, for example
Code:
myCombo.List(0).ItemData = 20

HTH

Bob
 
it simple u...

u create ur combo box
either u bind it with a recordset or fill it with ur code
keep the combobox's style property to dropdowncombo
the trap the change event
the do a a search algoritmm/code
change the index property based on ur search
WALA

the coding part ill leave to u
for effort...

 
What in the world is "editable" about that?

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
<the[n] trap the change event
Personally, I avoid the change event, because it fires too often when code alters the contents of the box. On the other hand, I tried it out here and it has some advantages over the keypress event. For example, if you do an Undo, it fires and the keypress event doesn't.

That said, neither one fires when you select a member of the list, and you'll need to go through your routine if you do. Probably the click event, which also fires when you use arrow keys to make selections--I checked!

chmohan, that's a useful link, but the OP says he already knows how to do it in VB.Net. (I do note that he uses the KeyUp event, similar to the KeyPress event.)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top