应用实例二

假定要设计一个下图所示的窗口,自动列出订单表的所有产品供选择,单击确定按钮后,筛选出所选各产品的订单:

设计这样的窗口很简单,窗口插入一个CheckedListBox控件,一个“确定”按钮,一个“取消”按钮。
窗口的AfterLoad事件代码设置为:

Dim lb As WinForm.CheckedListBox = e.Form.Controls("CheckedListBox1")
lb
.ComboList = DataTables("订单").GetComboListString("产品")

“确定”按钮的代码设置为:

Dim s As String
Dim
l As WinForm
.CheckedListBox = e.Form.Controls("CheckedListBox1")
For
Each Index As Integer In l
.CheckedIndices
    If
s > "" Then
        s = s &
","
   
End If
    s = s &
"'" & l
.Items(Index) & "'"
Next
If
s > "" Then
    Tables
("订单").Filter = "产品 In (" & s & ")"
End
If
e
.Form.Close()


本页地址:http://www.foxtable.com/webhelp/topics/2410.htm