以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 自动计算  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=94586)

--  作者:yupeng
--  发布时间:2016/12/27 15:25:00
--  [求助] 自动计算

Dim str1 As String = ""
Dim t As Table = CurrentTable

Str1 = Str1 & "计行数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "

StatusBar.Message3 = str1

 

 

老师  我有一表的其中一例的字符串有32位  当我鼠标放到此单元格时就出错   

 

我想写个判断   不计算字符串起过10位以上的单元格   或者不计算字符串的例   

 

请问要怎样写代码   谢谢您

[此贴子已经被作者于2016/12/27 15:26:40编辑过]

--  作者:有点色
--  发布时间:2016/12/27 15:43:00
--  

Dim t As Table = CurrentTable
Dim str1 As String = ""
Dim flag As Boolean = True
For i As Integer = t.LeftCol To t.RightCol
    If t.cols(i).IsNumeric = False Then
        flag = False
    End If
Next
If flag Then
    Str1 = Str1 & "计行数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
StatusBar.Message3 = str1