Foxtable(狐表)用户栏目专家坐堂 → 下拉框问题


  共有1498人关注过本帖树形打印复制链接

主题:下拉框问题

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/24 12:39:00 [显示全部帖子]

Dim dt1 As DataTable = DataTables("表A")
Dim dt2 As DataTable = DataTables("表B")
Dim ls As new List(Of String)
For Each dr As DataRow In dt1.datarows
    If ls.Contains(dr("第一列")) = False Then
        ls.add(dr("第一列"))
    End If
Next
For Each dr As DataRow In dt2.datarows
    If ls.Contains(dr("第一列")) = False Then
        ls.add(dr("第一列"))
    End If
Next
Dim str As String = String.Join("|", ls.ToArray)
msgbox(str)
Tables("表C").cols("第一列").ComboList = str

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/24 15:32:00 [显示全部帖子]

prepareEdit事件

 

If e.Col.name = "第二列" Then
    Dim dt1 As DataTable = DataTables("表A")
    Dim dt2 As DataTable = DataTables("表B")
    Dim ls As new List(Of String)
    For Each dr As DataRow In dt1.Select("第一列 = '" & e.Row("第一列") & "'")
        If ls.Contains(dr("第二列")) = False Then
            ls.add(dr("第二列"))
        End If
    Next
    For Each dr As DataRow In dt2.Select("第一列 = '" & e.Row("第一列") & "'")
        If ls.Contains(dr("第二列")) = False Then
            ls.add(dr("第二列"))
        End If
    Next
    Dim str As String = String.Join("|", ls.ToArray)
    e.Col.ComboList = str
End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/24 16:22:00 [显示全部帖子]

 没看懂你6楼表达的意思。现在有什么问题?

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/24 16:35:00 [显示全部帖子]

 两个表?

 

Dim cb As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim txt As String = cb.Text '定义一个变量的值

Dim dt1 As DataTable = DataTables("表A")
Dim dt2 As DataTable = DataTables("表B")
Dim ls As new List(Of String)
For Each dr As DataRow In dt1.Select("第一列 like '%" & txt & "%'")
    If ls.Contains(dr("第二列")) = False Then
        ls.add(dr("第二列"))
    End If
Next
For Each dr As DataRow In dt2.Select("第一列 like '%" & txt & "%'")
    If ls.Contains(dr("第二列")) = False Then
        ls.add(dr("第二列"))
    End If
Next
Dim str As String = String.Join("|", ls.ToArray)

cb.ComboList = str


 


 回到顶部