How to see the controlsource and the display source properties?

白昼怎懂夜的黑 提交于 2019-12-12 04:18:07

问题


I have two tables, user and company, and I have a combo box in which I list all the companies I have in the company table. My question is, how to use databinding in foxpro to display the company name? When I save the information to the database, I only need to save the company ID; same for display, from the company ID I have in my user table, I would like to display the company name. I tried using the properties :

CmbCompany.controlesource = myTable.companyID
cmbCompany.displaysource = myTable.companyName

but this doesn't work, I missing something!


回答1:


Set the RowSource for the combo so that it puts the data you want to show in the first column, and the value you want to store in the second. Set BoundColumn to 2 and, if your ID field is numeric or integer, set BoundTo to .T.

I'd do all this in the property sheet, but something like this:

RowSourceType = 6-Fields
RowSource = Company.CompanyName, ID
BoundColumn = 2
BoundTo = .T.
ControlSource = MyTable.CompanyID

Tamar



来源:https://stackoverflow.com/questions/9827957/how-to-see-the-controlsource-and-the-display-source-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!