以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 窗口动态列表项目代码写法 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=161489) |
||||
-- 作者:天宇科技 -- 发布时间:2021/3/18 22:06:00 -- 窗口动态列表项目代码写法 Dim cmb As WinForm.ComboBox = e.Sender Dim str As String = e.Form.Controls("用户ID").TEXT cmb.ComboList = DataTables("员工信息").GetComboListString("姓名", "ID = \'" & str & "\'") Dim cmb As WinForm.ComboBox = e.Form.Controls("用户ID") Dim str As String = cmb.Value cmb.ComboList = DataTables("员工信息").GetComboListString("姓名","ID = \'" & str & "\'") 这两段代码,第二种写法,是不是错了?我测试,第一种写法,正常显示,第二种不正确显示列表项目。 [此贴子已经被作者于2021/3/18 22:30:36编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2021/3/18 22:12:00 -- Dim str As String = cmb.text |
||||
-- 作者:天宇科技 -- 发布时间:2021/3/18 22:17:00 -- 一样不行, 只能用第一种写法 |
||||
-- 作者:有点蓝 -- 发布时间:2021/3/18 22:18:00 -- 代码在哪个控件?什么事件里? |
||||
-- 作者:天宇科技 -- 发布时间:2021/3/18 22:21:00 -- 在列表框里的Enter事件。 [此贴子已经被作者于2021/3/18 22:21:35编辑过]
|
||||
-- 作者:天宇科技 -- 发布时间:2021/3/18 22:31:00 --
你下载测试,是帮助中的代码,我修改了。
|
||||
-- 作者:有点蓝 -- 发布时间:2021/3/18 22:39:00 -- 很简单的道理,代码在ComboBox2的事件里,那么e.Sender表示的是ComboBox2,然后给ComboBox2的.ComboList设置项目肯定是正常的 \'Dim cmb As WinForm.ComboBox = e.Sender \'Dim str As String = e.Form.Controls("ComboBox1").Value \'cmb.ComboList = DataTables("表A").GetComboListString("规格", "型号 = \'" & str & "\'") \' 这段代码表示给ComboBox1的ComboList设置项目 Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox1") Dim str As String = cmb.text cmb.ComboList = DataTables("表A").GetComboListString("规格", "型号 = \'" & str & "\'") 上面2段代码表示的完全不是一个意思 |
||||
-- 作者:天宇科技 -- 发布时间:2021/3/18 22:45:00 -- Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox2") Dim str As String =e.Form.Controls("ComboBox1").text cmb.ComboList = DataTables("表A").GetComboListString("规格", "型号 = \'" & str & "\'") 这样写才是正确的。谢谢蓝版这么晚了,还在指教。
|