Harryjr,
I have had many experiences with what you are seeking to do. I am a little baffeled by how no one wants to use a "ComboBox" as it's intended to be. It is only marginally tricky, but once you build a single class for it, it is very fast, and very nice. The biggest leap, I seem to find is most programmers are not comfortable dealing with Array's. Fox, however (as you probably know, based on your post above), has a great number of commands for manipulating arrays. Take an hour one afternoon, and just play around with them. You will be familiar quickly with their abilities. I'll try to provide some additional info here on how to best utilize Combo Box functionality.
VFP provides an excellent ComboBox, but it needs just a little bit of help. Creat a CombBox subclass, and add the following property:
ARRAYSOURCE[1] (When defining the property, enter it exaclty that way. This will tell VFP that you are creating an Array Property. When you view it in the Others tab, at the bottom, it will appear like this:
arraysource(1,0)
If it doesn't look like that, delete it and try again, because it's not right.
Now, in the Data tab, DO NOT set a Control Source value. (After 3 nights of pulling out my hair, I finally discovered, this can cause LOTS of problems.)
Next, in your RowSourceType, make it 5 - Array.
In your RowSrouce make it This.ArraySource
One of the interesting things about VFP ComboBoxes, is that there are really only 2 "RowSourceTypes" that really allow it to work as an effective ComboBox. (A box that allows you to either pick from a list, or CREATE new items.) They are 1 - Value, and 5 - Array. In reality, only type 1 will allow the use of the "AddListItem" method. But, the beauty of Fox is, the Array can be manipulated externally, and then "Updated" (or Requery()) as it changes. To do this, simply place "This.Requery" after any code in your combo box that changes the Array contents. (You don't need to do it simply after picking a new item, it's not necessary).
Now, in your Init Event, you will need to do something to populate your Array. (Usually, my Array is created based on some type of SQL statment, but it can be by any means which you create your array.) This is where the ArraySource comes in, for example, I might populate my array with:
SELECT DISTINCT TRANSACTYPES FROM TRANS INTO ARRAY This.ArraySource
Note that the "This.ArraySource" only works "Inside" this object, but you can populate it from other locations with:
ThisForm.ComboBoxName.ArraySource = <blah, blah, blah>
Where Blah are your Elements.
Creating the ArraySource proprty is important for establishing the Array in the control. Outside of that, you can then DIMENSION or populate it otherwise in any way you see fit. I frequently use multi-element arrays in my ComboBoxes, so that what my User picks, isn't necessarily the explicit value I'm going to act on, but rather some other column in the Array. (I suspect you get the idea).
Now, as for your incrmental search, there is an EXCELLENT method for this kind of thing, which is InteractiveChange Event. Because, InteractiveChange event fires *EVERY* time a value in the combo box changes. You can use things like ASCAN() in your interactive change to locate the value you have just entered, and begin to populate your "DisplayValue" or "Value" properties as appropriate. (I will admit, I have not done this specifically with a ComboBox, but I see no reason why it won't work. I use this process in a number of textboxes I have all the time, and fundamentally, a ComboBox is just a textbox with some added functionality.)
Also, I, in my LostFocus event, will take care of not have a ControlSource property set to the ComboBox. The reason for not setting a ControlSource is, if you are trying to save/display an item that for whatever reason is not in the list, VFP will display an EMPTY combo box if the ControlSource's value is not found in your ArraySource. So, (for instance, while you're adding a new item that doesn't already exist...) you'll want to keep your ComboBox happy by not "Hooking" it to a ControlSource. In the LostFocus event, it's easy enough to do a couple of things, but usually, I update the table directly with a good old fashioned "REPLACE" statment. Such as:
REPLACE TRANS.TRANSTYPE WITH This.Value
Also, in the Combo's REFRESH() method, you'll need to provide the value from the current field to the ComboBox, so that when say your record pointer changes, the ComboBox is sufficently updated.
Aside from the fact that you have some code to provide to get the specific functionality you want, (and without your spec's, I can't write it for you!

), this should provide everything you need to create a robust, single instance ComboBox to your form. Once you've done it once, it's good forever.
Best Regards,
Scott
Please let me know if this has helped
![[hammer] [hammer] [hammer]](/data/assets/smilies/hammer.gif)