顶。将简化进行到底。 再举例比较以下的前后应用,非常节约命令行数,达到1:6或1:7。
e.Form.Controls("ComboBox1").Combolist =DataTables("A表").getcomboliststring("分类") 一条语句相当于以下六条: Dim Items As String Dim lst As List(Of String) = DataTables("A表").GetuniqueValues("","分类") For Each Item As String In Lst Items = Items & "|" & Item Next e.Form.Controls("ComboBox1").ComboList = Items
e.Form.Controls("ComboBox2").Combolist=DataTables("A表").getcomboliststring("名称","[分类]='" & e.Form.Controls("ComboBox1").value & "'" ) 一条语句相当于以下七条: Dim drs As New List(Of string) '字符串集合 drs = DataTables("A表").GetUniqueValues("[分类]='" & e.Form.Controls("ComboBox1").value & "'" , "名称") Dim Val AS String For Each dr As string In drs Val = Val & "|" & dr Next e.Form.Controls("ComboBox2").Combolist = Val
|