示例,窗口1中有"ComboBox1"和"ComboBox2"和"Button17",给
"ComboBox1"和"ComboBox2"的AfterLoad设置
Dim cmd1 As New SQLCommand
Dim dt1 As DataTable
Dim cmb1 As WinForm.ComboBox
cmd1.CommandText = "SELECT DISTINCT 姓名 From {基本资料}"
dt1 = cmd1.ExecuteReader()
cmb1 = e.Form.Controls("ComboBox2")
cmb1.ComboList= dt1.GetComboListString("姓名")
Dim cmd2 As New SQLCommand
Dim dt2 As DataTable
Dim cmb2 As WinForm.ComboBox
cmd2.CommandText = "SELECT DISTINCT 标识 From {基本资料}"
dt2 = cmd2.ExecuteReader()
cmb2 = e.Form.Controls("ComboBox1")
cmb2.ComboList= dt2.GetComboListString("标识")
"Button17"的Click设置
Dim Filter As String
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = "标识 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "姓名 = '" & .Value & "'"
End If
End With
DataTables("基本资料").LoadFilter = filter
DataTables("基本资料").Load
然后 出现这个
此主题相关图片如下:qq截图20140602153736.png
此主题相关图片如下:qq截图20140602153720.png