以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  怎样从ABCDEF六列的当前行单元格中选取最大的数字?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=117280)

--  作者:comnets
--  发布时间:2018/4/10 9:13:00
--  怎样从ABCDEF六列的当前行单元格中选取最大的数字?
横向选最大最小,不是一列,怎么实现?
--  作者:有点甜
--  发布时间:2018/4/10 9:40:00
--  
Dim ary() As String = {"A", "B" , "C"}
Dim max As Double = 0
For Each s As String In ary
    If e.DataRow(s) > max Then
        max = e.DataRow(s)
    End If
Next
msgbox(max)

--  作者:comnets
--  发布时间:2018/4/10 10:05:00
--  
编译错误 ‘}’ expected
是{}里的内容太多了吗?
我放进去17个列名。

找到了。一个列名有误。
我再试试。
[此贴子已经被作者于2018/4/10 10:09:54编辑过]

--  作者:有点甜
--  发布时间:2018/4/10 10:07:00
--  
以下是引用comnets在2018/4/10 10:05:00的发言:
编译错误 ‘}’ expected
是{}里的内容太多了吗?
我放进去17个列名。

 

贴出你写的这句代码


--  作者:y2287958
--  发布时间:2018/4/10 10:08:00
--  
放到集合或数组中,然后排序取值
--  作者:comnets
--  发布时间:2018/4/10 10:12:00
--  
成功返回了。

我现在想要返回最多数字的那里一列的列名,怎么实现?

--  作者:有点甜
--  发布时间:2018/4/10 10:19:00
--  
Dim ary() As String = {"A", "B" , "C"}
Dim max As Double = 0
For Each s As String In ary
    If e.DataRow(s).length > max Then
        max = e.DataRow(s).length
    End If
Next
msgbox(max)

--  作者:comnets
--  发布时间:2018/4/10 10:30:00
--  
不是长度,是ABC三列当前行中哪一个单元格数字最大,返回这一列的列名。
--  作者:有点甜
--  发布时间:2018/4/10 10:37:00
--  

Dim ary() As String = {"A", "B" , "C"}
Dim max As Double = -999
Dim name As String = ""
For Each s As String In ary
    If e.DataRow(s) > max Then
        max = e.DataRow(s)
        name = s
    End If
Next
msgbox(max)
msgbox(name)

--  作者:comnets
--  发布时间:2018/4/10 10:50:00
--  
取到的列名是A_1这种格式,可以截取_后面的字符吗?