Foxtable(狐表)用户栏目专家坐堂 → [求助]判断成绩为空则名次也为空。


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

主题:[求助]判断成绩为空则名次也为空。

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


加好友 发短信
等级:一尾狐 帖子:407 积分:3194 威望:0 精华:0 注册:2011/2/28 11:57:00
[求助]判断成绩为空则名次也为空。  发帖心情 Post By:2022/2/18 11:30:00 [显示全部帖子]

下面红色字体代码表示:如果成绩单元格为空则该成绩名次也为空,执行结果显示要么是1,要么是最后1名。如何修改代码?请指教。谢谢!
Tables("成绩库").StopRedraw
e.Form.Controls("Label1").text="排名中,请稍候..."
Dim Time,Time1 As Date
Time = Date.now
Dim pm As List(Of String()) = CurrentTable.DataTable.GetValues("年级|部别")
Dim pmc As Integer
Dim ColNames() As String = {"总分","总分1","语文","数学","英语","物理","历史","政治","政治1","地理","地理1","化学","化学1","生物","生物1"}
Dim TotalName As String
CurrentTable.Redraw = False
For Each ColName As String In ColNames
    For i As Integer = 0 To pm.Count -1
        If pm(i)(0) = "" Then
            Continue For
        End If
        Dim drs As List(Of DataRow) = CurrentTable.DataTable.Select("[年级] = '" & pm(i)(0) & "'And [部别] = '" & pm(i)(1) & "'", ColName & " DESC") '字符型
        pmc = 0
        TotalName = ColName & "名次"
        For n As Integer = 0 To drs.Count - 1
            If ColName Is Nothing Then
                drs(n)(TotalName ) = Nothing
            Else
                pmc = pmc +1
                If n > 0 AndAlso drs(n)(ColName ) = drs(n-1)(ColName) Then
                    drs(n)(TotalName ) = drs(n-1)(TotalName )
                Else
                    drs(n)(TotalName ) = pmc
                End If
            End If
        Next
    Next
Next
CurrentTable.Redraw = True
Time1 = Date.Now
e.Form.Controls("Label4").text="耗时 " & (Time1-Time).TotalSeconds & " 秒"
e.Form.Controls("Label1").Text = "总分排名结束!"
Tables("成绩库").ResumeRedraw

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


加好友 发短信
等级:一尾狐 帖子:407 积分:3194 威望:0 精华:0 注册:2011/2/28 11:57:00
  发帖心情 Post By:2022/2/18 12:23:00 [显示全部帖子]

谢谢!

 回到顶部