我是Visual FoxPro的新成员,遇到了一些困难
我有combobox(combo1),listbox(list1)和表(table1和table2) combo1的rowsource是table1.records 如果我在combo1中选择一条记录,它将显示从table2到list1的所有数据
是否可以这样做?感谢您的帮助:)
答案 0 :(得分:0)
请记住,这只是基于“猜测”的示例:
Public oForm
oForm = Createobject('SampleForm')
oForm.Show()
Define Class SampleForm As Form
Height = 800
Width=600
DataSession = 2
Add Object cmbCustomers As ComboBox With Top=10, Left=10, Width=250
Add Object lstOrders As ListBox With Top=10, Left=280, Height=780, Width=310
Procedure Init
With This.cmbCustomers
.RowSourceType = 3 && -SQL
.RowSource = "select CompanyName, CustomerId from ('"+;
_Samples+;
"Northwind\Customers') into cursor crsCustomers nofilter"
.ListIndex=1
Endwith
With This.lstOrders
.RowSourceType = 3 && -SQL
.RowSource = "select OrderId, OrderDate, ShippedDate, CustomerId from ('"+;
_Samples+;
"Northwind\Orders') o"+;
" where o.CustomerId = crsCustomers.CustomerId"+;
" into cursor crsOrders nofilter"
.ColumnCount = 3
.ColumnWidths = '70,120,120'
Endwith
Endproc
Procedure cmbCustomers.InteractiveChange
With Thisform.lstOrders
.ListIndex = 0
.Requery()
Endwith
Endproc
Enddefine