Foxtable(狐表)用户栏目专家坐堂 → [求助]怎样在同一单元格内追加字符串


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

主题:[求助]怎样在同一单元格内追加字符串

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/8 9:57:00 [显示全部帖子]

单独做一个按钮执行

 

Dim tjdr As DataRow = DataTables("统计").find("试卷号 = '1'")
Dim kfdr As DataRow = DataTables("答案").find("试卷号 = '1'")
tjdr("A") = Nothing
tjdr("B") = Nothing
tjdr("C") = Nothing
tjdr("D") = Nothing
For Each dr As DataRow In DataTables("卷1").DataRows
    Dim t1 As String = dr("题1答")
    Dim d1 As String = kfdr("题1答案")
    Dim t2 As String = dr("题2答")
    Dim d2 As String = kfdr("题2答案")
    Dim ts() As String = {t1, t2}
    Dim ds() As String = {d1, d2}
    Dim name As String = dr("姓名")
    For i As Integer = 0 To ts.length-1
        For Each s As String In ts(i)
            If ds(i).Contains(s) = False Then
                If tjdr.DataTable.DataCols.Contains(s) Then
                    tjdr(s) = tjdr(s) & name & ","
                End If
            End If
        Next
    Next
Next
tjdr("A") = tjdr("A").trim(",")
tjdr("B") = tjdr("B").trim(",")
tjdr("C") = tjdr("C").trim(",")
tjdr("D") = tjdr("D").trim(",")


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/8 10:45:00 [显示全部帖子]

 写到 mainTableChanged 事件

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/8 15:30:00 [显示全部帖子]

Dim tjdr As DataRow = DataTables("统计").find("试卷号 = '1'")
Dim kfdr As DataRow = DataTables("答案").find("试卷号 = '1'")
tjdr("A") = Nothing
tjdr("B") = Nothing
tjdr("C") = Nothing
tjdr("D") = Nothing
For Each dr As DataRow In DataTables("卷1").DataRows
    Dim t1 As String = dr("题1答")
    Dim d1 As String = kfdr("题1答案")
    Dim t2 As String = dr("题2答")
    Dim d2 As String = kfdr("题2答案")
    Dim ts() As String = {t1, t2}
    Dim ds() As String = {d1, d2}
    Dim name As String = dr("姓名")
    For i As Integer = 0 To ts.length-1
        For Each s As String In ts(i)
            If ds(i).Contains(s) = False Then
                If tjdr.DataTable.DataCols.Contains(s) AndAlso tjdr(s).contains(name) = False Then
                    tjdr(s) = tjdr(s) & name & ","
                End If
            End If
        Next
    Next
    For i As Integer = 0 To ts.length-1
        For Each s As String In ds(i)
            If ts(i).Contains(s) = False Then
                If tjdr.DataTable.DataCols.Contains(s) AndAlso tjdr(s).contains(name) = False Then
                    tjdr(s) = tjdr(s) & name & ","
                End If
            End If
        Next
    Next
Next
tjdr("A") = tjdr("A").trim(",")
tjdr("B") = tjdr("B").trim(",")
tjdr("C") = tjdr("C").trim(",")
tjdr("D") = tjdr("D").trim(",")

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/8 21:09:00 [显示全部帖子]

 代码没有问题啊


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/8 22:24:00 [显示全部帖子]

Dim tjdr As DataRow = DataTables("统计").find("试卷号 = '1'")
Dim kfdr As DataRow = DataTables("答案").find("试卷号 = '1'")
tjdr("A") = Nothing
tjdr("B") = Nothing
tjdr("C") = Nothing
tjdr("D") = Nothing
For Each dr As DataRow In DataTables("卷1").DataRows
    Dim t1 As String = dr("题1答")
    Dim d1 As String = kfdr("题1答案")
    Dim t2 As String = dr("题2答")
    Dim d2 As String = kfdr("题2答案")
    If t1 > "" AndAlso t2 > "" Then
        Dim ts() As String = {t1, t2}
        Dim ds() As String = {d1, d2}
        Dim name As String = dr("姓名")
        For i As Integer = 0 To ts.length-1
            For Each s As String In ts(i)
                If ds(i).Contains(s) = False Then
                    If tjdr.DataTable.DataCols.Contains(s) AndAlso tjdr(s).contains(name) = False Then
                        tjdr(s) = tjdr(s) & name & ","
                    End If
                End If
            Next
        Next
        For i As Integer = 0 To ts.length-1
            For Each s As String In ds(i)
                If ts(i).Contains(s) = False Then
                    If tjdr.DataTable.DataCols.Contains(s) AndAlso tjdr(s).contains(name) = False Then
                        tjdr(s) = tjdr(s) & name & ","
                    End If
                End If
            Next
        Next
    End If
Next
tjdr("A") = tjdr("A").trim(",")
tjdr("B") = tjdr("B").trim(",")
tjdr("C") = tjdr("C").trim(",")
tjdr("D") = tjdr("D").trim(",")

 回到顶部