【问题标题】:VFP combobox displaying all data to listboxVFP 组合框将所有数据显示到列表框
【发布时间】:2018-09-03 00:37:20
【问题描述】:

我是visual foxpro的新人,遇到了一些困难

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

可以这样做吗?谢谢你的帮助:)

【问题讨论】:

  • 亲爱的 Mav,我觉得你的问题对于 VFP 来说很简单,但我不得不承认你想要做什么是无法理解的。你能提供一些样品吗?下面我将提供一个使用 Northwind 示例数据在黑暗中拍摄的示例(客户在组合框中,当您选择时,选择的客户订单显示在列表框中) - 不确定您是否是这样的意思。

标签: visual-foxpro foxpro


【解决方案1】:

请记住,这只是一个基于“猜测”的示例:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-26
    • 2013-04-23
    • 1970-01-01
    • 2014-10-22
    • 2015-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多