Foxtable(狐表)用户栏目专家坐堂 → 请大师指教!谢谢!


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

主题:请大师指教!谢谢!

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


加好友 发短信
等级:三尾狐 帖子:670 积分:5217 威望:0 精华:0 注册:2013/10/7 22:27:00
请大师指教!谢谢!  发帖心情 Post By:2017/3/14 21:57:00 [只看该作者]

您好大师!我有两个表,一个是Tables("susrnydcge"),另一个是Tables("nyfgge"),觉得代码太长,请求大师代为优化.谢谢!!!
Dim t As Table = Tables("susrnydcge")
If t.Rows.Count = 0 Then
    Return
Else
    Dim a = t.Current
    Dim ny1 = a("nydc1")
    Dim ny2 = a("nydc2")
    Dim ny3 = a("nydc3")
    Dim ny4 = a("nydc4")
    Dim ny5 = a("nydc5")
    Dim ny6 = a("nydc6")
    Dim ny7 = a("nydc7")
    Dim ny8 = a("nydc8")
    Dim ny9 = a("nydc9")
    Dim ny10 = a("nydc10")
    With Tables("nyfgge")
        .Cols("nydc1").Caption = ny1
        .Cols("nydc2").Caption = ny2
        .Cols("nydc3").Caption = ny3
        .Cols("nydc4").Caption = ny4
        .Cols("nydc5").Caption = ny5
        .Cols("nydc6").Caption = ny6
        .Cols("nydc7").Caption = ny7
        .Cols("nydc8").Caption = ny8
        .Cols("nydc9").Caption = ny9
        .Cols("nydc10").Caption = ny10
        .BuildHeader()
    End With
    With Tables("nyfgge")
        If a.Isnull("nydc1") = True Then
            .Cols("nydc1").Visible = False
        Else
            .Cols("nydc1").Visible = True
        End If
        If a.Isnull("nydc2") = True Then
            .Cols("nydc2").Visible = False
        Else
            .Cols("nydc2").Visible = True
        End If
        If a.Isnull("nydc3") = True Then
            .Cols("nydc3").Visible = False
        Else
            .Cols("nydc3").Visible = True
        End If
        If a.Isnull("nydc4") = True Then
            .Cols("nydc4").Visible = False
        Else
            .Cols("nydc4").Visible = True
        End If
        If a.Isnull("nydc5") = True Then
            .Cols("nydc5").Visible = False
        Else
            .Cols("nydc5").Visible = True
        End If
        If a.Isnull("nydc6") = True Then
            .Cols("nydc6").Visible = False
        Else
            .Cols("nydc6").Visible = True
        End If
        If a.Isnull("nydc7") = True Then
            .Cols("nydc7").Visible = False
        Else
            .Cols("nydc7").Visible = True
        End If
        If a.Isnull("nydc8") = True Then
            .Cols("nydc8").Visible = False
        Else
            .Cols("nydc8").Visible = True
        End If
        If a.Isnull("nydc9") = True Then
            .Cols("nydc9").Visible = False
        Else
            .Cols("nydc9").Visible = True
        End If
        If a.Isnull("nydc10") = True Then
            .Cols("nydc10").Visible = False
        Else
            .Cols("nydc10").Visible = True
        End If
    End With
End If

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


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

Dim t As Table = Tables("susrnydcge")
If t.Rows.Count = 0 Then
    Return
Else
    Dim a = t.Current
    Dim c As strig = "nydc"
    With Tables("nyfgge")
        For i As Integer = 1 To 10
            .Cols(c & i).Caption = a(c & i)
            .Cols(c & i).Visible = (a.Isnull(c & i) = False)
        Next
    End With
End If
[此贴子已经被作者于2017/3/14 22:11:12编辑过]

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


加好友 发短信
等级:三尾狐 帖子:670 积分:5217 威望:0 精华:0 注册:2013/10/7 22:27:00
  发帖心情 Post By:2017/3/15 0:31:00 [只看该作者]

谢谢大师指教!!!

 回到顶部