以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助] (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=161620) |
|
-- 作者:awnu -- 发布时间:2021/3/24 15:17:00 -- [求助] 在做学生排名时,运行代码出现“在 Range 对象中,Min (506)必须小于或等于 max (-1)。”不知是什么原因? |
|
-- 作者:有点蓝 -- 发布时间:2021/3/24 15:20:00 --
|
|
-- 作者:awnu -- 发布时间:2021/3/24 15:26:00 -- Tables("九年级").StopRedraw Dim bjs As List(Of String) = DataTables("九年级").GetValues("班级","[班级] Is Not NULL") Dim Count As Integer Dim ColNames() As String = {"总分"} Dim TotalName As String For Each ColName As String In ColNames \' For i As Integer = 0 To bjs.Count -1 Dim drs As List(Of DataRow) = DataTables("九年级").Select("[班级] = " & bjs(i), ColName & " DESC") Count = 0 TotalName = ColName & "排名" For n As Integer = 0 To drs.Count - 1 Count = Count + 1 If n > 0 AndAlso drs(n)(ColName ) = drs(n-1)(ColName) Then drs(n)(TotalName ) = drs(n-1)(TotalName ) Else drs(n)(TotalName ) = Count End If Next Next Next Tables("九年级").Sort = "总分 DESC" Tables("九年级").ResumeRedraw
|
|
-- 作者:awnu -- 发布时间:2021/3/24 15:27:00 -- 不知道问题出自哪儿? |
|
-- 作者:有点蓝 -- 发布时间:2021/3/24 15:31:00 -- 调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm,看什么事件哪一句代码出错 |