VFP组合框将所有数据显示到列表框

问题描述 投票:-2回答:1

我刚刚在视觉foxpro中介绍并遇到一些困难

我有combobox(combo1),listbox(list1)和表(table1和table2)combo1的rowsource是table1.records如果我在combo1中选择一条记录,它将显示从table2到list1的所有数据

是否有可能做到这一点?谢谢你的帮助 :)

visual-foxpro foxpro
1个回答
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
© www.soinside.com 2019 - 2024. All rights reserved.