Foxtable(狐表)用户栏目专家坐堂 → [求助]窗口控件联动 代码修改


  共有3048人关注过本帖平板打印复制链接

主题:[求助]窗口控件联动 代码修改

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


加好友 发短信
等级:幼狐 帖子:83 积分:637 威望:0 精华:0 注册:2013/3/28 14:15:00
[求助]窗口控件联动 代码修改  发帖心情 Post By:2020/4/8 13:11:00 [只看该作者]

Dim str As String =e.Form.Controls("cplx").Value '控件1值
Dim str1 As String '控件2名称
Dim str2 As String '控件2值
Dim str3 As String '控件3名称
For Each ctl As WinForm.Control In e.Form.Controls '遍历所有控件
    If TypeOf ctl Is WinForm.ComboBox Then
        str1 = e.Form.Controls(ctl.Name) '
        str2= e.Form.Controls(str1).Value '效果:
        str3 = "dw"&Right(str1,1) '  控件2名称=”fjmc1” 有1-20个 对应 控件3名称=”dw1”有1-20个
        If str2 = Nothing  Then '控件2值为空,那么控件3值为空
            e.Form.Controls(str3).value = Nothing '效果:控件3值为空
        Else
            e.Form.Controls(str3).value =DataTables("字典").Find(str&"_辅件_名称" = str2,str&"_辅件_单位")  '控件3值          '
            '查找字典表 str&"_辅件_名称" 列 对应 str&"_辅件_单位"的数据
        End If
    End If
Next
'整体思路,当控件2选择后,根据其值不同在控件3中自动填入字典表的对应单位,目前的问题就是控件3赋值,代码写不好


 回到顶部
总数 15 1 2 下一页