To what Evan said about using an array property to hold the list, you can add the following to the lost focus (or valid) to deal with values that are not in the combo's list. You may also want to add something similar to the init to make sure the controlsource value gets put in the list.
liOldValue = this.displayvalue
lnResult = 1
IF !EMPTY(THIS.DISPLAYVALUE)
lnResult = ASCAN(THIS.aList, THIS.DISPLAYVALUE)
ENDIF
IF lnResult = 0
nNewListLen = ALEN(THIS.aList) + 1
DIMENSION THIS.aList[ nNewListLen ]
THIS.aList[ nNewListLen ] = THIS.DISPLAYVALUE
ASORT(THIS.aList)
THIS.DISPLAYVALUE = liOldValue
THIS.VALUE = liOldValue
ENDIF
hth
>Hi Tariq. Here are some ideas.
>
>1) Create your own combobox class. Add to this class an array property. In the init of your combo you can load the array using a select statment and then order the data any way you want.
>
>SELECT Accounting_unit.Accunit_name,Acc_code FROM accounting_unit order by 1 into this.cboArray
>
>You rowsourcetype would be set to an array and the rowsource would be this.cboArray
>
>If you change your combobox to a dropdown list then you won't have to worry about the user typing in values that are not in the combobox already. Of course, this is only valid if all accounts are in the combobox.
>
>This is just one suggestion. Others will have other ideas.
>
>>I am using a combo Box with Following Properties :
>>
>>MyComboname.Controlsource = Accounting_unit.Accunit_code
>>MyComboname.Rowsourcetype = 6
>>MyComboname.Rowsourcee = Accounting_unit.Accunit_name,Acc_code
>>MyComboname.columncount = 2
>>MyComboname.Bountto = 2
>>
>>What I wants, I want to display the Unit Description in First column and the code in second column and want to get the code on selection of any item from list.
>>
>>1).I want order on First Column so that the user can use Incrementalsearch.
>>2.)Some times User Enter the value by hand now, How to decide that the user entered the value by hand of select from list.
>>2). How to use Combo Array with Ascan() function to find the type value in list if i decide that the use entered the value by hand.
>>
>>I would thaks if some one mail me the simple form with code on
>>tariq_anjum@hotmail.com
>>Thanks
>>.
Roi
'MCP' Visual FoxPro
In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!