Foxtable(狐表)用户栏目专家坐堂 → 窗口数据合计


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

主题:窗口数据合计

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/24 22:20:00 [显示全部帖子]


Dim sum As Integer
Dim str As String
Dim st As String = "施工人员:混凝土工:3人,钢筋工:1人,木工:2人,共计:6人"
st = st.Replace("施工人员:", "")
Dim ary As String() = st.split(",")
For Each c As WinForm.Control In e.Form.Controls
    If Typeof c Is WinForm.label Then '判断控件是否是文本框
        Dim t As WinForm.label = c '使用特定类型的变量引用控件
        For Each s As String In ary
            If s.contains(t.text) Then
                Dim lbname As String = t.name
                e.form.controls(lbname.replace("_lb", "_tbx")).text = s.split(":")(1)
            End If
        Next
    End If
Next

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/25 12:12:00 [显示全部帖子]

Dim str as string = ""
Dim dics As new SortedDictionary(Of String, object)
For Each c As object In e.form.controls
    dics.Add(c.name, c)
Next
For Each key As Integer In dics.keys
    Dim cc = dics(key)
    If Typeof cc Is WinForm.ComboBox Then '判断控件是否是文本框
        Dim t As WinForm.ComboBox = cc '使用特定类型的变量引用控件
        If t.Name.EndsWith("_tbx") AndAlso t.Text > ""
            str = str & e.Form.controls(t.Name.Split("_")(0) & "_lb").text & t.Text & ","
            'sum += val(t.Text)
        End If
    End If   
Next
msgbox(str)

 

如果有问题,具体项目也发上来测试。


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/25 14:45:00 [显示全部帖子]

Dim str As String
Dim dics As new SortedDictionary(Of String, object)
For Each c As object In e.form.controls
    dics.Add(c.name, c)
Next
For Each key As String In dics.keys
    Dim cc = dics(key)
    If Typeof cc Is WinForm.ComboBox Then '判断控件是否是文本框
        Dim t As WinForm.ComboBox = cc '使用特定类型的变量引用控件
        If t.Name.EndsWith("_tbx") AndAlso t.Text > ""
            str = str & e.Form.controls(t.Name.Split("_")(0) & "_lb").text & t.Text & ","
            'sum += val(t.Text)
        End If
    End If   
Next
msgbox(str)

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/25 15:55:00 [显示全部帖子]

Dim str As String
Dim dics As new SortedDictionary(Of Integer, object)
For Each c As object In e.form.controls
    If c.Name.EndsWith("_tbx") Then
        dics.Add(c.tabindex, c)
    End If
Next
For Each key As Integer In dics.keys
    Dim cc = dics(key)
    If Typeof cc Is WinForm.ComboBox Then '判断控件是否是文本框
        Dim t As WinForm.ComboBox = cc '使用特定类型的变量引用控件
        If t.Name.EndsWith("_tbx") AndAlso t.Text > ""
            str = str & e.Form.controls(t.Name.Split("_")(0) & "_lb").text & t.Text & ","
            'sum += val(t.Text)
        End If
    End If
Next
msgbox(str)

 回到顶部