Foxtable(狐表)用户栏目专家坐堂 → [求助] 单元格填入多次内容


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

主题:[求助] 单元格填入多次内容

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


加好友 发短信
等级:五尾狐 帖子:1029 积分:6497 威望:0 精华:0 注册:2014/1/3 12:49:00
  发帖心情 Post By:2016/4/11 8:42:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:360截图20160411084127105.jpg
图片点击可在新窗口打开查看

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/4/11 8:45:00 [只看该作者]

参考19、20楼

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


加好友 发短信
等级:五尾狐 帖子:1029 积分:6497 威望:0 精华:0 注册:2014/1/3 12:49:00
  发帖心情 Post By:2016/4/11 11:03:00 [只看该作者]

以下命令想实现将当前行的【ODM框ODF盘】单元格内容、拆分成4部分;并将内容分别填入到相对应的控件中去;我的命令该怎么修改?

 

【ODM框ODF盘】单元格内容格式为:【内容1】【内容2】【内容3】【内容4】

 

Dim dr As Row = e.Table.Current("ODM框ODF盘")

Dim reg As new System.Text.RegularExpressions.Regex.Matches(dr, "(?<=【{1}).+?(?=】{1})")
Dim mc As Object = reg.matches(dr)

If mc.Count = 4 Then

e.Form.Controls("ODF1").text =  mc(0).Value
e.Form.Controls("ODF2").text =  mc(1).Value
e.Form.Controls("ODF3").text =  mc(2).Value
e.Form.Controls("ODF4").text =  mc(3).Value
End If

 

 

分解出结果:控件【ODF1】内容为:内容1

                 控件【ODF2】内容为:内容2

                 控件【ODF3】内容为:内容3

                 控件【ODF4】内容为:内容4

[此贴子已经被作者于2016/4/11 11:03:54编辑过]

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/11 11:09:00 [只看该作者]

 

[此贴子已经被作者于2016/4/11 11:39:13编辑过]

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


加好友 发短信
等级:五尾狐 帖子:1029 积分:6497 威望:0 精华:0 注册:2014/1/3 12:49:00
  发帖心情 Post By:2016/4/11 11:20:00 [只看该作者]

Dim dr As Row = e.Table.Current
Dim reg As new System.Text.RegularExpressions.Regex.Matches(dr("ODM框ODF盘"), "(?<=【{1}).+?(?=】{1})")
Dim mc As Object = reg.matches(dr)

If mc.Count = 4 Then
e.Form.Controls("ODF1").text =  mc(0).Value
e.Form.Controls("ODF2").text =  mc(1).Value
e.Form.Controls("ODF3").text =  mc(2).Value
e.Form.Controls("ODF4").text =  mc(3).Value
End If

 

错误提示: System.Text.RegularExpressions.Regex.Matches 未定义类型


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/11 11:23:00 [只看该作者]

Dim dr As Row = e.Table.Current
Dim mc = System.Text.RegularExpressions.Regex.Matches(dr("ODM框ODF盘"), "(?<=【{1}).+?(?=】{1})")

If mc.Count = 4 Then
    e.Form.Controls("ODF1").text =  mc(0).Value
    e.Form.Controls("ODF2").text =  mc(1).Value
    e.Form.Controls("ODF3").text =  mc(2).Value
    e.Form.Controls("ODF4").text =  mc(3).Value
End If

[此贴子已经被作者于2016/4/11 11:39:26编辑过]

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


加好友 发短信
等级:五尾狐 帖子:1029 积分:6497 威望:0 精华:0 注册:2014/1/3 12:49:00
  发帖心情 Post By:2016/4/11 11:38:00 [只看该作者]

还是一样的错误提示,我的这个命令是准备写在表的PositionChanged中的

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/11 11:39:00 [只看该作者]

Dim dr As Row = e.Table.Current
Dim mc = System.Text.RegularExpressions.Regex.Matches(dr("ODM框ODF盘"), "(?<=【{1}).+?(?=】{1})")

If mc.Count = 4 Then
    e.Form.Controls("ODF1").text =  mc(0).Value
    e.Form.Controls("ODF2").text =  mc(1).Value
    e.Form.Controls("ODF3").text =  mc(2).Value
    e.Form.Controls("ODF4").text =  mc(3).Value
End If


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


加好友 发短信
等级:五尾狐 帖子:1029 积分:6497 威望:0 精华:0 注册:2014/1/3 12:49:00
  发帖心情 Post By:2016/4/11 13:14:00 [只看该作者]

1、以下红色命令为:如果dr("ODM框ODF盘")单元格为空,那么清空ODF1 --ODF4控件的内容;但是命令没有生效。为什么?

 

2、以下命令是否可以进行优化?

 

            Dim dr As Row = e.Table.Current
            Dim mc = System.Text.RegularExpressions.Regex.Matches(dr("ODM框ODF盘"), "(?<=【{1}).+?(?=】{1})")
            If mc.Count = 4 Then
                e.Form.Controls("ODF1").text = Nothing
                e.Form.Controls("ODF2").text = Nothing
                e.Form.Controls("ODF3").text = Nothing
                e.Form.Controls("ODF4").text = Nothing
                e.Form.Controls("ODF1").text =  mc(0).Value
                e.Form.Controls("ODF2").text =  mc(1).Value
                e.Form.Controls("ODF3").text =  mc(2).Value
                e.Form.Controls("ODF4").text =  mc(3).Value
               
            Else
                If mc.Count = 3 Then
                    e.Form.Controls("ODF1").text = Nothing
                    e.Form.Controls("ODF2").text = Nothing
                    e.Form.Controls("ODF3").text = Nothing
                    e.Form.Controls("ODF4").text = Nothing
                    e.Form.Controls("ODF1").text =  mc(0).Value
                    e.Form.Controls("ODF2").text =  mc(1).Value
                    e.Form.Controls("ODF3").text =  mc(2).Value
                Else
                    If mc.Count = 2 Then
                        e.Form.Controls("ODF1").text = Nothing
                        e.Form.Controls("ODF2").text = Nothing
                        e.Form.Controls("ODF3").text = Nothing
                        e.Form.Controls("ODF4").text = Nothing
                        e.Form.Controls("ODF1").text =  mc(0).Value
                        e.Form.Controls("ODF2").text =  mc(1).Value
                    Else
                        If mc.Count = 1 Then
                            e.Form.Controls("ODF1").text = Nothing
                            e.Form.Controls("ODF2").text = Nothing
                            e.Form.Controls("ODF3").text = Nothing
                            e.Form.Controls("ODF4").text = Nothing
                            e.Form.Controls("ODF1").text =  mc(0).Value
                        Else
                            If dr("ODM框ODF盘") Is Nothing Then
                                e.Form.Controls("ODF1").text = Nothing
                                e.Form.Controls("ODF2").text = Nothing
                                e.Form.Controls("ODF3").text = Nothing
                                e.Form.Controls("ODF4").text = Nothing
                            Else
                            End If
                        End If
                    End If
                End If
            End If


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/11 14:25:00 [只看该作者]

Dim dr As Row = e.Table.Current
Dim mc = System.Text.RegularExpressions.Regex.Matches(dr("ODM框ODF盘"), "(?<=【{1}).+?(?=】{1})")
For i As Integer = 1 To 4
    If mc.count >= i Then
        e.Form.Controls("ODF" & i).text =  mc(i).Value
    Else
        e.Form.Controls("ODF" & i).text = Nothing
    End If
Next

 回到顶部
总数 61 上一页 1 2 3 4 5 6 7 下一页