Hi Janusz,
It's a bug but it exists as far back as VFP6, maybe earlier. The workaround is to not to bind ControlSource to ThisForm.SomeProperty and either reference Value property of combobox directly or update ThisForm.SomeProperty in the InteractiChange event.
>Hello,
>
>Most of our tables have integer column as primary key and often we use combobox to select a row. We also store selected row id in form's property to use it later. Nothing unusual...
>
>And here is the bug:
>
>- combobox is based on alias (RowSourceType=2)
>- combobox is bound to numeric column (BoundTo=.T. and BoundColum=some_numeric_column)
>- combobox' ControlSource is set to ThisForm.SomeProperty (this prop is also numeric)
>
>there is no way to select an item and see the selection in textbox portion of a combo.
>
>There is some workarounds, but it requires additional code and the bug/behaviour is annoying. Could anyone confirm it?
>
>Here is short prog, so you can try it by yourselves if you wish...
>
>
>* this is my table with curstomers
>create cursor customers (name c(20), id i)
>insert into customers values ('Company One',11)
>insert into customers values ('Company Two',12)
>insert into customers values ('Company Three',13)
>insert into customers values ('Company Four',14)
>insert into customers values ('Company Five',15)
>
>* here is form
>frm = createobject('form')
>
>* here is form's prop to store selected customer id
>* NOTE! this property is numeric (as id field is)
>frm.addproperty('companyid',0)
>
>* let's prepare combo box
>frm.addobject('cbo','combobox')
>with frm.cbo
> .top = 100
> .left = 100
> .rowsourcetype = 2
> .rowsource = 'customers'
> .boundcolumn = 2
> .boundto = .t.
> .controlsource = 'ThisForm.companyid'
> .visible = .t.
>endwith
>
>messagebox('try to select a customer from a combo!')
>
>frm.show(1)
>
>use in customers
>
>
>Best,
>
>Janusz Czudek
>WORD Software
>
http://www.wordsoft.com.pl
--sb--