Foxtable(狐表)用户栏目专家坐堂 → 多值


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

主题:多值

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


加好友 发短信
等级:七尾狐 帖子:1503 积分:10158 威望:0 精华:0 注册:2013/6/8 16:19:00
  发帖心情 Post By:2020/11/28 12:11:00 [只看该作者]

Dim sre As String = DataTables("表A").GetComboListString("月日多值列")
Dim str() As String = sre.Replace(",","|").split("|")
Dim lst1 As new List(of String)
Dim lst2 As new List(of String)
Dim s1,s2 As String
For Each s As String In str
    If s.length = 4 Then
        s1 = s.substring(0,2)
        If lst1.Contains(s1) = False Then lst1.Add(s1)
        s2 = s.substring(2)
        If lst2.Contains(s2) = False Then lst2.Add(s2)
    End If
Next
If lst1.Count > 0 Then
    e.form.Controls("ComboBox1").ComboList = String.Join("|",lst1.ToArray)
End If
If lst2.Count > 0 Then
    e.form.Controls("ComboBox2").ComboList = String.Join("|",lst2.ToArray)
End If


ComboBox2取值ComboBox1对应的数


ComboBox1取值ComboBox2必须也得取值才可以査询

[此贴子已经被作者于2020/11/28 12:18:20编辑过]

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


加好友 发短信
等级:超级版主 帖子:107135 积分:544918 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/11/28 14:06:00 [只看该作者]

没看懂,什么问题?

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


加好友 发短信
等级:七尾狐 帖子:1503 积分:10158 威望:0 精华:0 注册:2013/6/8 16:19:00
  发帖心情 Post By:2020/11/28 15:03:00 [只看该作者]

2、在ComboBox2的Enter事件中加入代码:

Dim cmb As WinForm.ComboBox = e.Sender
Dim
str As string = e.Form.Controls("ComboBox1").Value
cmb.ComboList =
DataTables("表A").GetComboListString("规格", "型号 = '" & str & "'"
)



像这样


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


加好友 发短信
等级:超级版主 帖子:107135 积分:544918 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/11/28 15:55:00 [只看该作者]

虽然绕过弯可以做得到,但是效率会很低,数据越多越低。
ComboBox1参考11楼的方式处理,ComboBox2enter事件遍历所有"月日多值列"数据,然后拆分项目看哪一个的前2个字符等于ComboBox1的值,取出来使用

建议换个方式,比如增加辅助列,把月和日分别存储处理,具体请上传实例说明。

 回到顶部
总数 14 上一页 1 2